Load packages
Set figure theme
theme_set(theme_minimal())
Define parameters
method <- c("rest","lpf","resid")
Create Schaefer labels
rois <- read.delim("scripts/schaefer_100parcels_7networks_labels.txt",
header = FALSE)
colnames(rois) <- "roi"
# add column for network
rois <- rois %>%
mutate(tmp = roi) %>%
separate(tmp, c(NA,"net",NA,NA), sep = "_") %>%
suppressWarnings()
Load behavioral data from facat
behav <- read_csv("data/aepet2_sem.csv") %>%
select(ssid, facat_acc_cat_old, facat_acc_cat_new, facat_acc_recog_chr)
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## .default = col_double()
## )
## ℹ Use `spec()` for the full column specifications.
Load aepet2 data
aepet2 <- readRDS("data/schaefconn.rds") %>%
unnest_wider(data) %>%
rename(conn = ...1,
connz = ...2) %>%
suppressMessages()
Load motion data
qa <- read_csv("data/qa_reg.csv")
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## .default = col_double()
## )
## ℹ Use `spec()` for the full column specifications.
Exclusions
## Complete exclusions
## participants excluded for missing rest OR 3+ runs of exposure
# sub-21: too much data scrubbed
# sub-25: rest, fell asleep
# sub-49: all runs, fell asleep during pre-exposure and was giving responses during post-exposure
# sub-60: all runs, looked like sleeping during rest and pre-exposure
# sub-61: all runs, looked like sleeping during entire scan
# sub-62: all runs, non-compliant, fell asleep, and too much motion
aepet2 <- aepet2 %>%
filter( !(sbjs %in% c(21,25,49,60,61)) )
length(unique(aepet2$sbjs))
## [1] 56
## Partial exclusions
## participants missing no more than 2 exposure runs
# sub-34: expo4, task didn't run
aepet2$conn[aepet2$sbjs==34 & str_detect(aepet2$runs, "expo_run-4")] <- NA
aepet2$connz[aepet2$sbjs==34 & str_detect(aepet2$runs, "expo_run-4")] <- NA
# sub-56: expo3-4, gave responses during post-exposure task
aepet2$conn[aepet2$sbjs==56 & str_detect(aepet2$runs, "expo_run-4|expo_run-3")] <- NA
aepet2$connz[aepet2$sbjs==56 & str_detect(aepet2$runs, "expo_run-4|expo_run-3")] <- NA
# sub-63: expo3-4, fell asleep during post-exposure
aepet2$conn[aepet2$sbjs==63 & str_detect(aepet2$runs, "expo_run-4|expo_run-3")] <- NA
aepet2$connz[aepet2$sbjs==63 & str_detect(aepet2$runs, "expo_run-4|expo_run-3")] <- NA
Separate and average across runs
# rest connectivity
rest <- aepet2 %>%
filter(runs == "rest") %>%
rename(method = runs)
# low-pass filter connectivity
lpf <- aepet2 %>%
filter(str_detect(runs, "lpf")) %>%
group_by(sbjs) %>%
summarize(conn = list(rowMeans(simplify2array(conn[!is.na(conn)]), dims = 2)),
connz = list(rowMeans(simplify2array(connz[!is.na(connz)]), dims = 2)),
.groups = "keep") %>%
mutate(method = "lpf")
# residual connectivity
resid <- aepet2 %>%
filter(str_detect(runs, "resid")) %>%
group_by(sbjs) %>%
summarize(conn = list(rowMeans(simplify2array(conn[!is.na(conn)]), dims = 2)),
connz = list(rowMeans(simplify2array(connz[!is.na(connz)]), dims = 2)),
.groups = "keep") %>%
mutate(method = "resid")
## merge them into single df
# also remove the factor groups of the method column
df <- rbind(rest, lpf, resid) %>%
mutate(method = factor(method))
# # can probably clear these out
# rm(rest, lpf, resid)
Melt the z matrices for analysis + add column for network + add column for hemisphere + add column for within or between network connection
# get the lower matrix only
df_lower <- df %>%
mutate(conn = map(conn, ~{
tmp <- .x
tmp[upper.tri(tmp, diag = TRUE)] <- NA
return(tmp)
}),
connz = map(connz, ~{
tmp <- .x
tmp[upper.tri(tmp, diag = TRUE)] <- NA
return(tmp)
}))
# melt correlation matrices
# too large so had to keep separate
df_meltz <- df_lower %>%
select(-conn) %>%
group_by(sbjs, method) %>%
mutate(connz = list(melt(connz,
varnames = c("roi1","roi2"),
value.name = "connz",
na.rm = TRUE))) %>%
unnest(connz) %>%
select(-contains("L1")) %>%
suppressMessages()
df_melt <- df_lower %>%
select(-connz) %>%
group_by(sbjs, method) %>%
mutate(conn = list(melt(conn,
varnames = c("roi1","roi2"),
value.name = "conn",
na.rm = TRUE))) %>%
unnest(conn) %>%
select(-contains("L1")) %>%
suppressMessages()
# create column identifying the network for each ROI
## joining seems weird, but computationally much easier than dealing with 80k+ warnings
# then, create column identifying within/between-network connections
df_meltz <- left_join(df_meltz, rois, by = c("roi1" = "roi")) %>%
rename(net1 = net) %>%
left_join(rois, by = c("roi2" = "roi")) %>%
rename(net2 = net) %>%
mutate(nettype = ifelse(net1 == net2, "within", "between"))
df_melt <- left_join(df_melt, rois, by = c("roi1" = "roi")) %>%
rename(net1 = net) %>%
left_join(rois, by = c("roi2" = "roi")) %>%
rename(net2 = net) %>%
mutate(nettype = ifelse(net1 == net2, "within", "between"))
We will first look at how similar within-subject patterns of connectivity are between the three methods (rest, low pass filter, and FIR residual connectivity).
Figure 2. 3 group-averaged raw connectivity matrices (rest, lpf, residual) with the ROIs organized by the 7 cortical networks
dfAvg <- df %>%
group_by(method) %>%
summarize(conn = list(rowMeans(simplify2array(conn), dims = 2)),
.groups = "keep")
tmp <- dfAvg %>%
filter(method == "rest")
tmp <- tmp$conn[[1]]
netcolors <- c(rep("#E69F00", 17),
rep("#56B4E9", 14),
rep("#009E73", 15),
rep("#F0E442", 12),
rep("#0072B2", 5),
rep("#D55E00", 13),
rep("#CC79A7",24))
walk(method, ~{
fig_groupavg <- dfAvg %>%
filter(method == .x) %$%
ggcorrplot(conn[[1]], method = "square", outline.color = FALSE,
lab = FALSE, tl.col = netcolors, tl.cex = 5, title = .x,
legend.title = "Conn (r)")
# STARTED ADDING COLORS TO LABELS FINISH LATER
# corrplot::corrplot(tmp, method = "color",
# type = "full", bg = "white",
# tl.srt = 45, tl.col = netcolors,
# outline = FALSE)
fname <- str_c("figures/", .x, "_groupAvg.pdf")
# ggsave(fname,
# fig_groupavg,
# width = 8, height = 8)
})
For each subject, spearman correlations will be conducted between the Fisher z transformed connectivity estimates for each method (i.e., rest-lpf, rest-resid, lpf-resid). The spearman correlation coefficients will then be Fisher z transformed for analysis.
corrMethods <- df_meltz %>%
pivot_wider(names_from = method,
values_from = connz) %>%
group_by(sbjs) %>%
summarize(rest_lpf = cor(rest, lpf, method = "spearman"),
rest_resid = cor(rest, resid, method = "spearman"),
lpf_resid = cor(lpf, resid, method = "spearman"),
.groups = "keep") %>%
mutate(rest_lpfz = psych::fisherz(rest_lpf),
rest_residz = psych::fisherz(rest_resid),
lpf_residz = psych::fisherz(lpf_resid))
A paired-samples t-test will be conducted to compare which method produces connectivity estimates more similar to resting state connectivity (rest-lpf correlations v. rest-resid correlations).
lpf_v_resid <- t.test(corrMethods$rest_lpfz, corrMethods$rest_residz,
paired = TRUE) %>%
broom::tidy()
cohensd <- corrMethods %>%
select(sbjs, rest_lpfz, rest_residz) %>%
pivot_longer(cols = c(2:3),
names_to = "comparison",
values_to = "rz") %$%
lsr::cohensD(rz ~ comparison,
method = "paired")
## Warning in lsr::cohensD(rz ~ comparison, method = "paired"): calculating paired
## samples Cohen's d using formula input. Results will be incorrect if cases do not
## appear in the same order for both levels of the grouping factor
(lpf_v_rest <- lpf_v_resid %>%
mutate(cohensd = cohensd))
# modify df for plotting
# calculate mean and sd for each comparison
corrMethods_mod <- corrMethods %>%
select(sbjs, !contains("z")) %>%
pivot_longer(cols = 2:4,
names_to = "comparison",
values_to = "r") %>%
group_by(comparison) %>%
mutate(mean = mean(r),
se = lurr::se(r)) %>%
ungroup() %>%
mutate(comparison = fct_relevel(comparison,
"rest_lpf", "rest_resid"))
Figure 3. Boxplot showing the distribution of spearman correlations in the pattern of connectivity between the methods (i.e., rest-lpf, rest-resid, lpf-resid).
colorlabs <- c("#1b9e77","#d95f02","#666666")
(fig_corrMethods_bp <- corrMethods_mod %>%
ggplot(aes(x = comparison, y = r, color = comparison)) +
geom_boxplot(size = 1.1) +
geom_dotplot(aes(fill = comparison),
binaxis = "y", stackdir = "center",
alpha = .4, dotsize = .75) +
#scale_color_brewer(type = "qual", palette = "Dark2") +
#scale_fill_brewer(type = "qual", palette = "Dark2") +
scale_fill_manual(values = colorlabs) +
scale_color_manual(values = colorlabs) +
theme(legend.position = "none",
text = element_text(size = 30),
axis.text = element_text(color = "black"),
axis.title.x = element_text(margin = margin(t = 10)),
axis.title.y = element_text(margin = margin(r = 10))) +
labs(x = "Comparison",
y = "Similarity (rho)") +
scale_x_discrete(labels = c("RestxLPF","RestxFIR","LPFxFIR")) +
ylim(c(.3,1)))
## Bin width defaults to 1/30 of the range of the data. Pick better value with `binwidth`.
# ggsave("figures/corr_methods_boxplot.pdf",
# fig_corrMethods_bp, dpi = 300,
# width = 7, height = 6, units = "in")
Or the figure that Dasa suggested..
# (fig_corrMethods2 <- corrMethods_mod %>%
# ungroup() %>%
# filter(comparison != "lpf_resid") %>%
# ggplot(aes(x = comparison)) +
# geom_bar(aes(y = mean, color = comparison), stat = "summary", size = 1.01,
# fun = "mean", fill = "white") +
# geom_line(aes(y = r, group = sbjs),
# alpha = .5) +
# geom_point(aes(y = r, color = comparison), stat = "identity",
# alpha = .5, size = 3) +
# scale_color_brewer(type = "qual", palette = "Dark2") +
# theme(legend.position = "none",
# text = element_text(size = 30),
# axis.text = element_text(color = "black"),
# axis.title.x = element_text(margin = margin(t = 10)),
# axis.title.y = element_text(margin = margin(r = 10))) +
# labs(x = "Comparison", y = "Spearman's rho") +
# scale_x_discrete(labels = c("RestxLPF","RestxFIR")) +
# ylim(c(0,1)) )
# ggsave("figures/corr_methods_lines_wide.pdf",
# fig_corrMethods2, dpi = 300,
# width = 7, height = 6, units = "in")
Run correlation and plot scatterplot to show correlation between LPF x Rest similarity and Resid x Rest similarity.
cor.test(corrMethods$rest_lpfz, corrMethods$rest_residz)
##
## Pearson's product-moment correlation
##
## data: corrMethods$rest_lpfz and corrMethods$rest_residz
## t = 18.445, df = 54, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.8813351 0.9579305
## sample estimates:
## cor
## 0.9289863
fig_corrComps <- corrMethods %>%
ggplot(aes(x = rest_lpf, y = rest_resid)) +
geom_point(stat = "identity", alpha = .5) +
# geom_smooth(method = "lm", color = "black") +
theme(text = element_text(size = 30),
axis.text = element_text(color = "black"),
axis.title.x = element_text(margin = margin(t = 10)),
axis.title.y = element_text(margin = margin(r = 10))) +
xlim(c(.3,1)) +
ylim(c(.3,1)) +
labs(x = "Rest x LPF Similarity (rho)",
y = "Rest x FIR Similarity (rho)") +
geom_abline(slope = 1, linetype = "dashed")
(fig_corrComps <- ggMarginal(fig_corrComps, data = corrMethods_mod, type = "density",
xparams = list(fill = "#1B9E77", alpha = .75),
yparams = list(fill = "#D95F02", alpha = .75)))
#
# ggsave("figures/corr_methods_scatter.pdf",
# fig_corrComps, dpi = 300,
# width = 7, height = 6)
Is inconsistency between rest and background connectivity driven by motion?
qa_corrMethods <- left_join(corrMethods, qa, by = c("sbjs" = "ssid")) %>%
left_join(behav, by = c("sbjs" = "ssid")) %>%
select(-rest_lpf, -rest_resid, -lpf_resid, -contains("csf"),
-contains("wm"), -contains("wholebrain")) %>%
mutate(expo_propkept = (reg_expo1_propkept_isok2 + reg_expo2_propkept_isok2+ reg_expo3_propkept_isok2 + reg_expo1_propkept_isok2)/4)
cor(qa_corrMethods, use = "pairwise.complete.obs")
## sbjs rest_lpfz rest_residz lpf_residz
## sbjs 1.000000000 0.071138815 0.06372845 0.119536319
## rest_lpfz 0.071138815 1.000000000 0.92898626 0.759120789
## rest_residz 0.063728454 0.928986265 1.00000000 0.636216287
## lpf_residz 0.119536319 0.759120789 0.63621629 1.000000000
## reg_rest_propkept_isok 0.067676646 -0.003767838 -0.02437681 -0.008314062
## reg_rest_propkept_isok2 -0.077562585 0.235780919 0.20531687 0.185078234
## reg_rest_m_absfd -0.025436168 0.032661625 0.12133821 -0.103442828
## reg_rest_m_absdvars -0.057997117 0.094384493 0.08582247 0.112394278
## reg_expo1_propkept_isok -0.082987415 0.087256682 0.06113640 0.161546454
## reg_expo1_propkept_isok2 -0.158542230 0.186759652 0.18894376 0.276116351
## reg_expo1_m_absfd 0.005846334 0.079647810 0.16304595 -0.012588558
## reg_expo1_m_absdvars 0.012342353 -0.076579747 -0.07771480 -0.147179011
## reg_expo2_propkept_isok -0.111432780 0.206390245 0.20686048 0.336748816
## reg_expo2_propkept_isok2 -0.106504030 0.168281458 0.10934590 0.174391596
## reg_expo2_m_absfd 0.112726007 -0.091214132 -0.03589477 -0.168208457
## reg_expo2_m_absdvars 0.103808004 -0.059636267 -0.06664707 -0.208923089
## reg_expo3_propkept_isok 0.124381911 0.144756576 0.18406797 0.288120134
## reg_expo3_propkept_isok2 -0.083831009 0.315690690 0.37453129 0.379334754
## reg_expo3_m_absfd 0.083487451 -0.098982550 -0.08470208 -0.277364008
## reg_expo3_m_absdvars -0.015723962 0.075436990 -0.01885015 -0.077194207
## reg_expo4_propkept_isok 0.041796471 0.122164975 0.18841601 0.335250908
## reg_expo4_propkept_isok2 -0.053900587 0.434155088 0.48383304 0.483069798
## reg_expo4_m_absfd 0.099604681 -0.018573797 -0.02834431 -0.201758846
## reg_expo4_m_absdvars 0.003152478 -0.078891213 -0.15407296 -0.242635077
## facat_acc_cat_old 0.132940697 0.318403639 0.32946817 0.380175935
## facat_acc_cat_new 0.125536722 0.216015255 0.22117929 0.346104597
## facat_acc_recog_chr -0.244241273 0.227351595 0.23518029 0.219792646
## expo_propkept -0.157283054 0.272092886 0.26968881 0.345283608
## reg_rest_propkept_isok reg_rest_propkept_isok2
## sbjs 0.067676646 -0.07756258
## rest_lpfz -0.003767838 0.23578092
## rest_residz -0.024376808 0.20531687
## lpf_residz -0.008314062 0.18507823
## reg_rest_propkept_isok 1.000000000 0.63205297
## reg_rest_propkept_isok2 0.632052970 1.00000000
## reg_rest_m_absfd -0.350917573 -0.15608584
## reg_rest_m_absdvars -0.770107303 -0.52571602
## reg_expo1_propkept_isok 0.327452987 0.25706731
## reg_expo1_propkept_isok2 0.057063895 0.20562776
## reg_expo1_m_absfd -0.111939074 0.08470567
## reg_expo1_m_absdvars -0.341137002 -0.18754734
## reg_expo2_propkept_isok 0.338208343 0.28037858
## reg_expo2_propkept_isok2 0.129831778 0.38644093
## reg_expo2_m_absfd -0.122429083 -0.07441803
## reg_expo2_m_absdvars -0.277473865 -0.18434344
## reg_expo3_propkept_isok 0.349409602 0.22022019
## reg_expo3_propkept_isok2 0.232108177 0.43203766
## reg_expo3_m_absfd -0.137816360 -0.13721078
## reg_expo3_m_absdvars -0.280804261 -0.09986075
## reg_expo4_propkept_isok 0.227322875 0.09694904
## reg_expo4_propkept_isok2 0.178925690 0.38325000
## reg_expo4_m_absfd -0.021801941 0.05647905
## reg_expo4_m_absdvars -0.290029964 -0.16264482
## facat_acc_cat_old 0.098008258 0.17726669
## facat_acc_cat_new -0.003948818 0.02313180
## facat_acc_recog_chr -0.237885600 -0.06878950
## expo_propkept 0.157315458 0.40445089
## reg_rest_m_absfd reg_rest_m_absdvars
## sbjs -0.02543617 -0.05799712
## rest_lpfz 0.03266163 0.09438449
## rest_residz 0.12133821 0.08582247
## lpf_residz -0.10344283 0.11239428
## reg_rest_propkept_isok -0.35091757 -0.77010730
## reg_rest_propkept_isok2 -0.15608584 -0.52571602
## reg_rest_m_absfd 1.00000000 0.43566615
## reg_rest_m_absdvars 0.43566615 1.00000000
## reg_expo1_propkept_isok -0.17532285 -0.30507436
## reg_expo1_propkept_isok2 -0.17406240 -0.03349316
## reg_expo1_m_absfd 0.79198524 0.20825801
## reg_expo1_m_absdvars 0.34311298 0.52294718
## reg_expo2_propkept_isok 0.01093545 -0.17033259
## reg_expo2_propkept_isok2 -0.01137882 -0.07069925
## reg_expo2_m_absfd 0.67929703 0.16295727
## reg_expo2_m_absdvars 0.01872948 0.29956965
## reg_expo3_propkept_isok -0.33067153 -0.26619311
## reg_expo3_propkept_isok2 -0.05099218 -0.12419486
## reg_expo3_m_absfd 0.69874074 0.12783811
## reg_expo3_m_absdvars 0.31366908 0.34158750
## reg_expo4_propkept_isok -0.10026678 -0.07782495
## reg_expo4_propkept_isok2 0.09401092 -0.04707153
## reg_expo4_m_absfd 0.61384510 0.01710169
## reg_expo4_m_absdvars 0.17664587 0.22863116
## facat_acc_cat_old -0.11971402 -0.03959331
## facat_acc_cat_new 0.02921874 0.09978470
## facat_acc_recog_chr 0.12724466 0.14293938
## expo_propkept -0.11871303 -0.08631205
## reg_expo1_propkept_isok reg_expo1_propkept_isok2
## sbjs -0.08298741 -0.15854223
## rest_lpfz 0.08725668 0.18675965
## rest_residz 0.06113640 0.18894376
## lpf_residz 0.16154645 0.27611635
## reg_rest_propkept_isok 0.32745299 0.05706390
## reg_rest_propkept_isok2 0.25706731 0.20562776
## reg_rest_m_absfd -0.17532285 -0.17406240
## reg_rest_m_absdvars -0.30507436 -0.03349316
## reg_expo1_propkept_isok 1.00000000 0.46703552
## reg_expo1_propkept_isok2 0.46703552 1.00000000
## reg_expo1_m_absfd -0.25090003 -0.16640518
## reg_expo1_m_absdvars -0.69094952 -0.36836310
## reg_expo2_propkept_isok 0.54820667 0.23125967
## reg_expo2_propkept_isok2 0.50105921 0.24618385
## reg_expo2_m_absfd -0.23039500 -0.20796307
## reg_expo2_m_absdvars -0.46447347 -0.08167844
## reg_expo3_propkept_isok 0.31970680 0.41724994
## reg_expo3_propkept_isok2 0.27322839 0.65774029
## reg_expo3_m_absfd -0.18060257 -0.40755792
## reg_expo3_m_absdvars -0.25748427 -0.25631769
## reg_expo4_propkept_isok 0.29054968 0.45618525
## reg_expo4_propkept_isok2 0.30581596 0.38103078
## reg_expo4_m_absfd -0.11352974 -0.32395891
## reg_expo4_m_absdvars -0.32575431 -0.35735592
## facat_acc_cat_old 0.16099675 0.31930241
## facat_acc_cat_new 0.18303960 0.41313285
## facat_acc_recog_chr 0.12338534 0.16569167
## expo_propkept 0.54400621 0.86991372
## reg_expo1_m_absfd reg_expo1_m_absdvars
## sbjs 0.005846334 0.01234235
## rest_lpfz 0.079647810 -0.07657975
## rest_residz 0.163045947 -0.07771480
## lpf_residz -0.012588558 -0.14717901
## reg_rest_propkept_isok -0.111939074 -0.34113700
## reg_rest_propkept_isok2 0.084705668 -0.18754734
## reg_rest_m_absfd 0.791985236 0.34311298
## reg_rest_m_absdvars 0.208258006 0.52294718
## reg_expo1_propkept_isok -0.250900025 -0.69094952
## reg_expo1_propkept_isok2 -0.166405183 -0.36836310
## reg_expo1_m_absfd 1.000000000 0.37382559
## reg_expo1_m_absdvars 0.373825586 1.00000000
## reg_expo2_propkept_isok 0.021602758 -0.38023585
## reg_expo2_propkept_isok2 -0.092671648 -0.30206775
## reg_expo2_m_absfd 0.793147616 0.33339229
## reg_expo2_m_absdvars 0.058638142 0.50257270
## reg_expo3_propkept_isok -0.200250611 -0.56027494
## reg_expo3_propkept_isok2 0.073807049 -0.27587664
## reg_expo3_m_absfd 0.754560618 0.33819387
## reg_expo3_m_absdvars 0.288623369 0.54655265
## reg_expo4_propkept_isok -0.161089883 -0.43598637
## reg_expo4_propkept_isok2 0.127610099 -0.36220175
## reg_expo4_m_absfd 0.726281981 0.24054570
## reg_expo4_m_absdvars 0.187242961 0.52486686
## facat_acc_cat_old -0.043172850 -0.13966499
## facat_acc_cat_new 0.070378010 -0.13602495
## facat_acc_recog_chr -0.014117973 -0.09611230
## expo_propkept -0.105274576 -0.41276451
## reg_expo2_propkept_isok reg_expo2_propkept_isok2
## sbjs -0.11143278 -0.10650403
## rest_lpfz 0.20639024 0.16828146
## rest_residz 0.20686048 0.10934590
## lpf_residz 0.33674882 0.17439160
## reg_rest_propkept_isok 0.33820834 0.12983178
## reg_rest_propkept_isok2 0.28037858 0.38644093
## reg_rest_m_absfd 0.01093545 -0.01137882
## reg_rest_m_absdvars -0.17033259 -0.07069925
## reg_expo1_propkept_isok 0.54820667 0.50105921
## reg_expo1_propkept_isok2 0.23125967 0.24618385
## reg_expo1_m_absfd 0.02160276 -0.09267165
## reg_expo1_m_absdvars -0.38023585 -0.30206775
## reg_expo2_propkept_isok 1.00000000 0.61177918
## reg_expo2_propkept_isok2 0.61177918 1.00000000
## reg_expo2_m_absfd -0.27429341 -0.39057990
## reg_expo2_m_absdvars -0.82517916 -0.59494021
## reg_expo3_propkept_isok 0.35240597 0.17010864
## reg_expo3_propkept_isok2 0.37561883 0.33899322
## reg_expo3_m_absfd -0.20308004 -0.12716318
## reg_expo3_m_absdvars -0.32985975 -0.08945579
## reg_expo4_propkept_isok 0.47617088 0.05498147
## reg_expo4_propkept_isok2 0.52311892 0.20492253
## reg_expo4_m_absfd -0.09650944 0.05740669
## reg_expo4_m_absdvars -0.42834631 -0.03346239
## facat_acc_cat_old 0.12388505 0.04394286
## facat_acc_cat_new 0.27001191 0.16111204
## facat_acc_recog_chr 0.01947900 -0.05290170
## expo_propkept 0.48737353 0.63344417
## reg_expo2_m_absfd reg_expo2_m_absdvars
## sbjs 0.11272601 0.103808004
## rest_lpfz -0.09121413 -0.059636267
## rest_residz -0.03589477 -0.066647066
## lpf_residz -0.16820846 -0.208923089
## reg_rest_propkept_isok -0.12242908 -0.277473865
## reg_rest_propkept_isok2 -0.07441803 -0.184343444
## reg_rest_m_absfd 0.67929703 0.018729480
## reg_rest_m_absdvars 0.16295727 0.299569652
## reg_expo1_propkept_isok -0.23039500 -0.464473473
## reg_expo1_propkept_isok2 -0.20796307 -0.081678439
## reg_expo1_m_absfd 0.79314762 0.058638142
## reg_expo1_m_absdvars 0.33339229 0.502572701
## reg_expo2_propkept_isok -0.27429341 -0.825179159
## reg_expo2_propkept_isok2 -0.39057990 -0.594940209
## reg_expo2_m_absfd 1.00000000 0.370403481
## reg_expo2_m_absdvars 0.37040348 1.000000000
## reg_expo3_propkept_isok -0.26900768 -0.316415876
## reg_expo3_propkept_isok2 -0.13873365 -0.321009812
## reg_expo3_m_absfd 0.77308195 0.194111176
## reg_expo3_m_absdvars 0.37045729 0.446842764
## reg_expo4_propkept_isok -0.23254877 -0.357395314
## reg_expo4_propkept_isok2 0.00160037 -0.356251933
## reg_expo4_m_absfd 0.69036731 0.080344540
## reg_expo4_m_absdvars 0.25464387 0.410718250
## facat_acc_cat_old -0.02067072 -0.055793032
## facat_acc_cat_new -0.01756735 -0.158212211
## facat_acc_recog_chr 0.02503932 0.000567005
## expo_propkept -0.31228431 -0.379139928
## reg_expo3_propkept_isok reg_expo3_propkept_isok2
## sbjs 0.1243819 -0.08383101
## rest_lpfz 0.1447566 0.31569069
## rest_residz 0.1840680 0.37453129
## lpf_residz 0.2881201 0.37933475
## reg_rest_propkept_isok 0.3494096 0.23210818
## reg_rest_propkept_isok2 0.2202202 0.43203766
## reg_rest_m_absfd -0.3306715 -0.05099218
## reg_rest_m_absdvars -0.2661931 -0.12419486
## reg_expo1_propkept_isok 0.3197068 0.27322839
## reg_expo1_propkept_isok2 0.4172499 0.65774029
## reg_expo1_m_absfd -0.2002506 0.07380705
## reg_expo1_m_absdvars -0.5602749 -0.27587664
## reg_expo2_propkept_isok 0.3524060 0.37561883
## reg_expo2_propkept_isok2 0.1701086 0.33899322
## reg_expo2_m_absfd -0.2690077 -0.13873365
## reg_expo2_m_absdvars -0.3164159 -0.32100981
## reg_expo3_propkept_isok 1.0000000 0.61079296
## reg_expo3_propkept_isok2 0.6107930 1.00000000
## reg_expo3_m_absfd -0.5351890 -0.35795637
## reg_expo3_m_absdvars -0.8001414 -0.44456420
## reg_expo4_propkept_isok 0.7044535 0.52789106
## reg_expo4_propkept_isok2 0.5293916 0.62230525
## reg_expo4_m_absfd -0.4061769 -0.22690307
## reg_expo4_m_absdvars -0.6967594 -0.43837910
## facat_acc_cat_old 0.2964688 0.36857070
## facat_acc_cat_new 0.3516686 0.37054711
## facat_acc_recog_chr 0.1263277 0.14303273
## expo_propkept 0.4979587 0.82430361
## reg_expo3_m_absfd reg_expo3_m_absdvars
## sbjs 0.08348745 -0.01572396
## rest_lpfz -0.09898255 0.07543699
## rest_residz -0.08470208 -0.01885015
## lpf_residz -0.27736401 -0.07719421
## reg_rest_propkept_isok -0.13781636 -0.28080426
## reg_rest_propkept_isok2 -0.13721078 -0.09986075
## reg_rest_m_absfd 0.69874074 0.31366908
## reg_rest_m_absdvars 0.12783811 0.34158750
## reg_expo1_propkept_isok -0.18060257 -0.25748427
## reg_expo1_propkept_isok2 -0.40755792 -0.25631769
## reg_expo1_m_absfd 0.75456062 0.28862337
## reg_expo1_m_absdvars 0.33819387 0.54655265
## reg_expo2_propkept_isok -0.20308004 -0.32985975
## reg_expo2_propkept_isok2 -0.12716318 -0.08945579
## reg_expo2_m_absfd 0.77308195 0.37045729
## reg_expo2_m_absdvars 0.19411118 0.44684276
## reg_expo3_propkept_isok -0.53518900 -0.80014142
## reg_expo3_propkept_isok2 -0.35795637 -0.44456420
## reg_expo3_m_absfd 1.00000000 0.57538365
## reg_expo3_m_absdvars 0.57538365 1.00000000
## reg_expo4_propkept_isok -0.50026129 -0.65435461
## reg_expo4_propkept_isok2 -0.27042155 -0.34784580
## reg_expo4_m_absfd 0.86084180 0.45920029
## reg_expo4_m_absdvars 0.49693711 0.74521938
## facat_acc_cat_old -0.26776776 -0.24069652
## facat_acc_cat_new -0.16890412 -0.24754706
## facat_acc_recog_chr -0.13812462 -0.09927645
## expo_propkept -0.39401293 -0.32258270
## reg_expo4_propkept_isok reg_expo4_propkept_isok2
## sbjs 0.04179647 -0.05390059
## rest_lpfz 0.12216497 0.43415509
## rest_residz 0.18841601 0.48383304
## lpf_residz 0.33525091 0.48306980
## reg_rest_propkept_isok 0.22732287 0.17892569
## reg_rest_propkept_isok2 0.09694904 0.38325000
## reg_rest_m_absfd -0.10026678 0.09401092
## reg_rest_m_absdvars -0.07782495 -0.04707153
## reg_expo1_propkept_isok 0.29054968 0.30581596
## reg_expo1_propkept_isok2 0.45618525 0.38103078
## reg_expo1_m_absfd -0.16108988 0.12761010
## reg_expo1_m_absdvars -0.43598637 -0.36220175
## reg_expo2_propkept_isok 0.47617088 0.52311892
## reg_expo2_propkept_isok2 0.05498147 0.20492253
## reg_expo2_m_absfd -0.23254877 0.00160037
## reg_expo2_m_absdvars -0.35739531 -0.35625193
## reg_expo3_propkept_isok 0.70445345 0.52939162
## reg_expo3_propkept_isok2 0.52789106 0.62230525
## reg_expo3_m_absfd -0.50026129 -0.27042155
## reg_expo3_m_absdvars -0.65435461 -0.34784580
## reg_expo4_propkept_isok 1.00000000 0.66711345
## reg_expo4_propkept_isok2 0.66711345 1.00000000
## reg_expo4_m_absfd -0.49723928 -0.18729220
## reg_expo4_m_absdvars -0.89722400 -0.63113907
## facat_acc_cat_old 0.28257060 0.34183660
## facat_acc_cat_new 0.37462751 0.35449390
## facat_acc_recog_chr 0.25503537 0.26168787
## expo_propkept 0.44861169 0.49475145
## reg_expo4_m_absfd reg_expo4_m_absdvars
## sbjs 0.09960468 0.003152478
## rest_lpfz -0.01857380 -0.078891213
## rest_residz -0.02834431 -0.154072963
## lpf_residz -0.20175885 -0.242635077
## reg_rest_propkept_isok -0.02180194 -0.290029964
## reg_rest_propkept_isok2 0.05647905 -0.162644821
## reg_rest_m_absfd 0.61384510 0.176645873
## reg_rest_m_absdvars 0.01710169 0.228631161
## reg_expo1_propkept_isok -0.11352974 -0.325754314
## reg_expo1_propkept_isok2 -0.32395891 -0.357355919
## reg_expo1_m_absfd 0.72628198 0.187242961
## reg_expo1_m_absdvars 0.24054570 0.524866865
## reg_expo2_propkept_isok -0.09650944 -0.428346306
## reg_expo2_propkept_isok2 0.05740669 -0.033462391
## reg_expo2_m_absfd 0.69036731 0.254643873
## reg_expo2_m_absdvars 0.08034454 0.410718250
## reg_expo3_propkept_isok -0.40617688 -0.696759393
## reg_expo3_propkept_isok2 -0.22690307 -0.438379098
## reg_expo3_m_absfd 0.86084180 0.496937114
## reg_expo3_m_absdvars 0.45920029 0.745219384
## reg_expo4_propkept_isok -0.49723928 -0.897224004
## reg_expo4_propkept_isok2 -0.18729220 -0.631139069
## reg_expo4_m_absfd 1.00000000 0.479069008
## reg_expo4_m_absdvars 0.47906901 1.000000000
## facat_acc_cat_old -0.14935237 -0.270343484
## facat_acc_cat_new -0.06694501 -0.302169139
## facat_acc_recog_chr -0.11563918 -0.143202090
## expo_propkept -0.23345750 -0.355777507
## facat_acc_cat_old facat_acc_cat_new
## sbjs 0.13294070 0.125536722
## rest_lpfz 0.31840364 0.216015255
## rest_residz 0.32946817 0.221179287
## lpf_residz 0.38017594 0.346104597
## reg_rest_propkept_isok 0.09800826 -0.003948818
## reg_rest_propkept_isok2 0.17726669 0.023131801
## reg_rest_m_absfd -0.11971402 0.029218742
## reg_rest_m_absdvars -0.03959331 0.099784702
## reg_expo1_propkept_isok 0.16099675 0.183039602
## reg_expo1_propkept_isok2 0.31930241 0.413132850
## reg_expo1_m_absfd -0.04317285 0.070378010
## reg_expo1_m_absdvars -0.13966499 -0.136024952
## reg_expo2_propkept_isok 0.12388505 0.270011911
## reg_expo2_propkept_isok2 0.04394286 0.161112036
## reg_expo2_m_absfd -0.02067072 -0.017567351
## reg_expo2_m_absdvars -0.05579303 -0.158212211
## reg_expo3_propkept_isok 0.29646884 0.351668622
## reg_expo3_propkept_isok2 0.36857070 0.370547114
## reg_expo3_m_absfd -0.26776776 -0.168904117
## reg_expo3_m_absdvars -0.24069652 -0.247547056
## reg_expo4_propkept_isok 0.28257060 0.374627514
## reg_expo4_propkept_isok2 0.34183660 0.354493901
## reg_expo4_m_absfd -0.14935237 -0.066945008
## reg_expo4_m_absdvars -0.27034348 -0.302169139
## facat_acc_cat_old 1.00000000 0.765942761
## facat_acc_cat_new 0.76594276 1.000000000
## facat_acc_recog_chr 0.27566457 0.088860540
## expo_propkept 0.31600971 0.414602388
## facat_acc_recog_chr expo_propkept
## sbjs -0.244241273 -0.15728305
## rest_lpfz 0.227351595 0.27209289
## rest_residz 0.235180292 0.26968881
## lpf_residz 0.219792646 0.34528361
## reg_rest_propkept_isok -0.237885600 0.15731546
## reg_rest_propkept_isok2 -0.068789499 0.40445089
## reg_rest_m_absfd 0.127244661 -0.11871303
## reg_rest_m_absdvars 0.142939376 -0.08631205
## reg_expo1_propkept_isok 0.123385338 0.54400621
## reg_expo1_propkept_isok2 0.165691670 0.86991372
## reg_expo1_m_absfd -0.014117973 -0.10527458
## reg_expo1_m_absdvars -0.096112296 -0.41276451
## reg_expo2_propkept_isok 0.019479001 0.48737353
## reg_expo2_propkept_isok2 -0.052901696 0.63344417
## reg_expo2_m_absfd 0.025039324 -0.31228431
## reg_expo2_m_absdvars 0.000567005 -0.37913993
## reg_expo3_propkept_isok 0.126327653 0.49795867
## reg_expo3_propkept_isok2 0.143032730 0.82430361
## reg_expo3_m_absfd -0.138124618 -0.39401293
## reg_expo3_m_absdvars -0.099276451 -0.32258270
## reg_expo4_propkept_isok 0.255035368 0.44861169
## reg_expo4_propkept_isok2 0.261687872 0.49475145
## reg_expo4_m_absfd -0.115639178 -0.23345750
## reg_expo4_m_absdvars -0.143202090 -0.35577751
## facat_acc_cat_old 0.275664573 0.31600971
## facat_acc_cat_new 0.088860540 0.41460239
## facat_acc_recog_chr 1.000000000 0.11915354
## expo_propkept 0.119153537 1.00000000
To quantify the similarity to rest connectivity, we will report the median correlation and the range of correlations. The median/range of correlations between low-pass filter connectivity and FIR residual connectivity will also be reported to evaluate how similar the estimates are between the two methods.
(corrMethods_sum <- corrMethods %>%
ungroup() %>%
select(-sbjs) %>%
psych::describe())
For each participant, we will calculate the within-network and between-network connectivity produced by each method. The mean within-network connectivity will be an average of all within-network connections, while the between-network connectivity will be an average of all between-network connections.
QUESTION when averaging the within-network connectivity, we want to exclude connections with themselves right? - YES. And they already do. When I take the connections from the lower half of the matrix (before I melt them), I exclude the diagonals (i.e., I exclude connections between an roi and itself).
# get mean connectivity for each network-network connection
# identify within- and between-network connections
connNetAll <- df_meltz %>%
unite(col = "netconn",
c(net1, net2),
sep = "_") %>%
group_by(sbjs, method, netconn, nettype) %>%
summarize(mconnz = mean(connz),
.groups = "keep")
connNetAll_sum <- connNetAll %>%
group_by(method, netconn, nettype) %>%
summarize(mean = mean(mconnz),
se = lurr::se(mconnz),
.groups = "keep")
# get mean within-network and between-network connectivity
# exclude diagonal connections
connNet <- df_meltz %>%
group_by(sbjs, method, nettype) %>%
summarize(mconnz = mean(connz),
.groups = "keep")
Figure 4 3 (rest, lpf, resid) 7x7 matrices showing the group-averaged within- and between-network connectivity for the raw estimates. Basically Figure 2 but now averaged down to show just the networks.
# group averaging network-network connectivity for each method
connNetAll_avg <- df_melt %>%
unite(col = "netconn",
c(net1, net2),
sep = "_") %>%
group_by(method, netconn, nettype) %>%
summarize(mconn = mean(conn),
.groups = "keep") %>%
separate(netconn, c("net1","net2")) %>%
ungroup()
network_order <- c("default","cont","limbic","salventattn",
"dorsattn","sommot","vis")
figs_connNetAll_avg <- map_dfr(method, ~{
# # troubleshoot
# .x <- "rest"
# filter out connections for method
tmp <- connNetAll_avg %>%
filter(method==.x)
# add in the upper triangle connections
tmp_sub <- tmp %>%
filter(nettype == "between") %>%
rename(net1 = net2,
net2 = net1)
# bind into single df
tmp <- rbind(tmp, tmp_sub) %>%
select(net1, net2, mconn) %>%
mutate(net1 = fct_relevel(net1,
rev(network_order)),
net2 = fct_relevel(net2,
rev(network_order))) %>%
arrange(net1)
# cast into matrix for plotting
tmpMat <- acast(data = tmp,
net1~net2,
value.var = "mconn")
# plot
tmpFig <- ggcorrplot(tmpMat,
method = "square",
outline.color = "white",
lab = TRUE,
legend.title = "Mean Conn (r)",
title = .x) # width 7, height 6
# ggsave(str_c("figures/connNetAll_",.x,".pdf"),
# tmpFig, dpi = 300,
# width = 7, height = 6, units = "in")
# return tibble with matrices and figures
return(tibble(method = .x,
corrmat = list(tmpMat),
figure = list(tmpFig)))
})
Figure 4B. OPTION 1 7x7 matrices showing the group-averaged differences in within- and between-network connectivity between each method (rest-lpf, rest-resid, lpf - resid).
# # calculating the differences in network-network connectivity between methods
# # averaging those differences across subjects
# connNetAll_avgDiffs <- connNetAll %>%
# ungroup() %>%
# pivot_wider(names_from = method,
# values_from = mconnz) %>%
# mutate(lpf_rest = lpf - rest,
# resid_rest = resid - rest,
# lpf_resid = lpf - resid) %>%
# select(-rest, -lpf, -resid) %>%
# pivot_longer(cols = 4:6,
# names_to = "comparison",
# values_to = "mconnz") %>%
# group_by(comparison, netconn, nettype) %>%
# summarize(mconnz = mean(mconnz),
# .groups = "keep") %>%
# separate(netconn, c("net1","net2")) %>%
# ungroup()
#
# comparison <- c("lpf_rest","resid_rest","lpf_resid")
#
# # plot correlation matrices
# figs_connNetAll_avgDiffs <- map_dfr(comparison, ~{
# # # troubleshoot
# # .x <- "lpf_rest"
#
# # filter out connections for method
# tmp <- connNetAll_avgDiffs %>%
# filter(comparison==.x)
#
# # add in the upper triangle connections
# tmp_sub <- tmp %>%
# filter(nettype == "between") %>%
# rename(net1 = net2,
# net2 = net1)
#
# # bind into single df
# tmp <- rbind(tmp, tmp_sub) %>%
# select(net1, net2, mconnz) %>%
# mutate(net1 = fct_relevel(net1,
# rev(network_order)),
# net2 = fct_relevel(net2,
# rev(network_order))) %>%
# arrange(net1)
#
# # cast into matrix for plotting
# tmpMat <- acast(data = tmp,
# net1~net2,
# value.var = "mconnz")
#
# # plot
# tmpFig <- ggcorrplot(tmpMat,
# method = "square",
# outline.color = "white",
# lab = TRUE,
# title = .x) # width 7, height 6
#
# # ggsave(str_c("figures/connNetAll_",.x,".pdf"),
# # tmpFig, dpi = 300,
# # width = 7, height = 6, units = "in")
#
# # return tibble with matrices and figures
# return(tibble(method = .x,
# corrmat = list(tmpMat),
# figure = list(tmpFig)))
# })
Figure 4B. OPTION 2 2 7x7 matrices showing the p-values of the differences in within- and between-network connectivity between rest-lpf and rest-resid.
# get p-values and effect sizes for comparisons between methods
connNetAll_compMethods <- connNetAll %>%
pivot_wider(names_from = method,
values_from = mconnz) %>%
group_by(netconn, nettype) %>%
summarize(p_lpf_rest = t.test(lpf, rest, paired = TRUE)$p.value,
p_resid_rest = t.test(resid, rest, paired = TRUE)$p.value,
p_lpf_resid = t.test(lpf, resid, paired = TRUE)$p.value,
d_lpf_rest = lsr::cohensD(lpf, rest, method = "paired"),
d_resid_rest = lsr::cohensD(resid, rest, method = "paired"),
d_lpf_resid = lsr::cohensD(lpf, resid, method = "paired"),
.groups = "keep") %>%
pivot_longer(cols = c(-1:-2),
names_to = "comparison",
values_to = "val") %>%
separate(comparison, c("type","comparison"),
extra = "merge") %>%
pivot_wider(names_from = type,
values_from = val) %>%
separate(netconn, c("net1","net2")) %>%
ungroup()
# comparison <- c("lpf_rest","resid_rest","lpf_resid")
#
# # plot matrices with p-values
# figs_connNetAll_pDiffs <- map_dfr(comparison, ~{
# # # troubleshoot
# # .x <- "lpf_rest"
#
# # filter out connections for method
# tmp <- connNetAll_compMethods %>%
# filter(comparison == .x)
#
#
# # add in the upper triangle connections
# tmp_sub <- tmp %>%
# filter(nettype == "between") %>%
# rename(net1 = net2,
# net2 = net1)
#
# # bind into single df
# tmp <- rbind(tmp, tmp_sub) %>%
# select(net1, net2, p) %>%
# mutate(net1 = fct_relevel(net1,
# rev(network_order)),
# net2 = fct_relevel(net2,
# rev(network_order))) %>%
# arrange(net1)
#
# # cast into matrix for plotting
# tmpMat <- acast(data = tmp,
# net1~net2,
# value.var = "p")
#
# # plot
# tmpFig <- ggcorrplot(tmpMat,
# method = "square",
# outline.color = "white",
# lab = TRUE,
# title = .x,
# legend.title = "p value") # width 7, height 6
#
# ggsave(str_c("figures/connNetAll_p_",.x,".pdf"),
# tmpFig, dpi = 300,
# width = 7, height = 6, units = "in")
#
# # return tibble with matrices and figures
# return(tibble(method = .x,
# corrmat = list(tmpMat),
# figure = list(tmpFig)))
# })
Figure 4C. OPTION 3 2 7x7 matrices showing the effect size (d) of the differences in within- and between-network connectivity between rest-lpf and rest-resid.
comparison <- c("lpf_rest","resid_rest","lpf_resid")
# plot matrices with p-values
figs_connNetAll_dDiffs <- map_dfr(comparison, ~{
# # troubleshoot
# .x <- "lpf_rest"
# filter out connections for method
tmp <- connNetAll_compMethods %>%
filter(comparison == .x)
# add in the upper triangle connections
tmp_sub <- tmp %>%
filter(nettype == "between") %>%
rename(net1 = net2,
net2 = net1)
# bind into single df
tmp <- rbind(tmp, tmp_sub) %>%
select(net1, net2, d) %>%
mutate(net1 = fct_relevel(net1,
rev(network_order)),
net2 = fct_relevel(net2,
rev(network_order))) %>%
arrange(net1)
# cast into matrix for plotting
tmpMat <- acast(data = tmp,
net1~net2,
value.var = "d")
# plot
tmpFig <- ggcorrplot(tmpMat,
method = "square",
outline.color = "white",
lab = TRUE,
title = .x) + # width 7, height 6
scale_fill_gradient(limit = c(0, 2.5),
low = "white", high = "red",
name = "Cohen's d")
# ggsave(str_c("figures/connNetAll_d_",.x,".pdf"),
# tmpFig, dpi = 300,
# width = 7, height = 6, units = "in")
# return tibble with matrices and figures
return(tibble(method = .x,
corrmat = list(tmpMat),
figure = list(tmpFig)))
})
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
We will run a 3 (method: rest, lpf, resid) x 2 (within-network, between-network) repeated measures ANOVA comparing the Fisher z transformed connectivity estimates.
# Run Omnibus ANOVA
(comp_connNet <- aov_ez(data = connNet,
id = "sbjs",
dv = "mconnz",
within = c("method","nettype")))
## Anova Table (Type 3 tests)
##
## Response: mconnz
## Effect df MSE F ges p.value
## 1 method 1.41, 77.65 0.00 135.13 *** .210 <.001
## 2 nettype 1, 55 0.01 2125.79 *** .946 <.001
## 3 method:nettype 1.41, 77.60 0.00 123.29 *** .301 <.001
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
##
## Sphericity correction method: GG
# Check tests for sphericity
summary(comp_connNet)
##
## Univariate Type III Repeated-Measures ANOVA Assuming Sphericity
##
## Sum Sq num Df Error SS den Df F value Pr(>F)
## (Intercept) 7.2478 1 0.17900 55 2226.95 < 2.2e-16 ***
## method 0.1953 2 0.07947 110 135.13 < 2.2e-16 ***
## nettype 12.9111 1 0.33405 55 2125.79 < 2.2e-16 ***
## method:nettype 0.3156 2 0.14082 110 123.29 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Mauchly Tests for Sphericity
##
## Test statistic p-value
## method 0.58332 4.7796e-07
## method:nettype 0.58253 4.6092e-07
##
##
## Greenhouse-Geisser and Huynh-Feldt Corrections
## for Departure from Sphericity
##
## GG eps Pr(>F[GG])
## method 0.70587 < 2.2e-16 ***
## method:nettype 0.70548 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## HF eps Pr(>F[HF])
## method 0.7189804 1.532180e-22
## method:nettype 0.7185621 2.014434e-21
# Estimated Marginal Means
### main effect of nettype
print("main effect of nettype")
## [1] "main effect of nettype"
(nettype.emm <- emmeans(comp_connNet, "nettype"))
## nettype emmean SE df lower.CL upper.CL
## between -0.0492 0.00128 55 -0.0517 -0.0466
## within 0.3429 0.00734 55 0.3282 0.3576
##
## Results are averaged over the levels of: method
## Confidence level used: 0.95
connNet %>% group_by(nettype) %>% summarize(mean = round(mean(mconnz), digits = 4), sd = round(sd(mconnz), digits = 4))
afex_plot(comp_connNet, x = "nettype", error = "within")
### main effect of method
(method.emm <- emmeans(comp_connNet, "method"))
## method emmean SE df lower.CL upper.CL
## rest 0.135 0.00340 55 0.128 0.141
## lpf 0.181 0.00468 55 0.171 0.190
## resid 0.125 0.00292 55 0.120 0.131
##
## Results are averaged over the levels of: nettype
## Confidence level used: 0.95
connNet %>% group_by(method) %>% summarize(mean = round(mean(mconnz), digits = 4), sd = round(sd(mconnz), digits = 4))
afex_plot(comp_connNet, x = "method", error = "within")
pairs(method.emm, adjust = "none")
## contrast estimate SE df t.ratio p.value
## rest - lpf -0.04591 0.00460 55 -9.969 <.0001
## rest - resid 0.00921 0.00305 55 3.020 0.0038
## lpf - resid 0.05512 0.00286 55 19.240 <.0001
##
## Results are averaged over the levels of: nettype
print("effect size for lpf v. fir")
## [1] "effect size for lpf v. fir"
connNet %>%
filter(method != "rest") %>%
mutate(method = factor(method)) %$%
lsr::cohensD(mconnz ~ method,
method = "paired")
## Warning in lsr::cohensD(mconnz ~ method, method = "paired"): calculating paired
## samples Cohen's d using formula input. Results will be incorrect if cases do not
## appear in the same order for both levels of the grouping factor
## [1] 0.6883034
print("effect size for lpf v. rest")
## [1] "effect size for lpf v. rest"
connNet %>%
filter(method != "resid") %>%
mutate(method = factor(method)) %$%
lsr::cohensD(mconnz ~ method,
method = "paired")
## Warning in lsr::cohensD(mconnz ~ method, method = "paired"): calculating paired
## samples Cohen's d using formula input. Results will be incorrect if cases do not
## appear in the same order for both levels of the grouping factor
## [1] 0.5735942
print("effect size for fir v. rest")
## [1] "effect size for fir v. rest"
connNet %>%
filter(method != "lpf") %>%
mutate(method = factor(method)) %$%
lsr::cohensD(mconnz ~ method,
method = "paired")
## Warning in lsr::cohensD(mconnz ~ method, method = "paired"): calculating paired
## samples Cohen's d using formula input. Results will be incorrect if cases do not
## appear in the same order for both levels of the grouping factor
## [1] 0.2254963
### method x nettype interaction
(method_nettype.emm <- emmeans(comp_connNet, c("method","nettype")))
## method nettype emmean SE df lower.CL upper.CL
## rest between -0.0480 0.00137 55 -0.0507 -0.0452
## lpf between -0.0579 0.00186 55 -0.0616 -0.0542
## resid between -0.0416 0.00127 55 -0.0442 -0.0390
## rest within 0.3173 0.00805 55 0.3011 0.3334
## lpf within 0.4190 0.01088 55 0.3972 0.4408
## resid within 0.2925 0.00693 55 0.2786 0.3063
##
## Confidence level used: 0.95
afex_plot(comp_connNet,
x = "nettype", trace = "method",
mapping = "color", error = "within")
# Post-Hoc Tests for Method x nettype Interaction
# # Comparing between network connectivity
# (comp_connBtw <- aov_ez(filter(connNet, nettype=="between"),
# id = "sbjs",
# dv = "mconnz",
# within = "method"))
# (method_btw.emm <- emmeans(comp_connBtw, "method"))
# pairs(method_btw.emm, adjust = "none")
#
# # Comparing between within connectivity
# (comp_connWtn <- aov_ez(filter(connNet, nettype=="within"),
# id = "sbjs",
# dv = "mconnz",
# within = "method"))
# (method_wtn.emm <- emmeans(comp_connWtn, "method"))
# pairs(method_wtn.emm, adjust = "none")
# Compare differences
connNet_diffs <- connNet %>%
pivot_wider(names_from = nettype,
values_from = mconnz) %>%
rowwise() %>%
mutate(diff = within - between)
comp_connDiffs <- aov_ez(data = connNet_diffs,
id = "sbjs",
dv = "diff",
within = "method")
(method_diffs.emm <- emmeans(comp_connDiffs, "method"))
## method emmean SE df lower.CL upper.CL
## rest 0.365 0.00934 55 0.347 0.384
## lpf 0.477 0.01249 55 0.452 0.502
## resid 0.334 0.00807 55 0.318 0.350
##
## Confidence level used: 0.95
afex_plot(comp_connDiffs, x = "method", error = "within")
pairs(method_diffs.emm, adjust = "none")
## contrast estimate SE df t.ratio p.value
## rest - lpf -0.1116 0.01226 55 -9.101 <.0001
## rest - resid 0.0312 0.00808 55 3.858 0.0003
## lpf - resid 0.1428 0.00766 55 18.651 <.0001
print("Cohen's d for LPF v FIR")
## [1] "Cohen's d for LPF v FIR"
connNet_diffs %>%
filter(method != "rest") %>%
mutate(method = factor(method)) %$%
lsr::cohensD(diff ~ method,
method = "paired")
## Warning in lsr::cohensD(diff ~ method, method = "paired"): calculating paired
## samples Cohen's d using formula input. Results will be incorrect if cases do not
## appear in the same order for both levels of the grouping factor
## [1] 2.492399
print("Cohen's d for LPF v rest")
## [1] "Cohen's d for LPF v rest"
connNet_diffs %>%
filter(method != "resid") %>%
mutate(method = factor(method)) %$%
lsr::cohensD(diff ~ method,
method = "paired")
## Warning in lsr::cohensD(diff ~ method, method = "paired"): calculating paired
## samples Cohen's d using formula input. Results will be incorrect if cases do not
## appear in the same order for both levels of the grouping factor
## [1] 1.216215
print("Cohen's d for FIR v rest")
## [1] "Cohen's d for FIR v rest"
connNet_diffs %>%
filter(method != "lpf") %>%
mutate(method = factor(method)) %$%
lsr::cohensD(diff ~ method,
method = "paired")
## Warning in lsr::cohensD(diff ~ method, method = "paired"): calculating paired
## samples Cohen's d using formula input. Results will be incorrect if cases do not
## appear in the same order for both levels of the grouping factor
## [1] 0.5155356
Figure 5A. Bar graph showing the group-averaged within- and between-network connections Fisher z transformed connectivity for each method. The within- and between- network connectivity will be averaged across the 7 networks.
# modify df for plotting
# create columns for mean/sd
connNet_mod <- connNet %>%
group_by(method, nettype) %>%
mutate(mean = mean(mconnz),
se = lurr::se(mconnz),
method = fct_relevel(method,
c("lpf","rest","resid")),
nettype = factor(nettype, levels = c("within","between")))
# create plot
(fig_connNet <- connNet_mod %>%
ggplot(aes(x = method, y = mconnz, color = nettype)) +
geom_bar(stat = "summary", fun = "mean", fill = "white",
position = position_dodge(width = .95)) +
geom_errorbar(aes(ymin = mean-se, ymax = mean+se),
stat = "identity", width = .2,
position = position_dodge(width = .95)) +
geom_point(aes(y = mconnz, fill = nettype),
stat = "identity", alpha = .3, size = 2,
position = position_jitterdodge(jitter.width = .3,
dodge.width = .95)) +
labs(x = "Connectivity Method",
y = "Mean Connectivity\n(Fisher z)",
color = "Network", fill = "Network") +
#scale_color_manual(values = c("#CC79A7","#0072B2")) +
scale_color_manual(values = c("#3d5a80","#b56576")) +
scale_x_discrete(labels = c("LPF","Rest","FIR")) +
theme(text = element_text(size = 24),
axis.text = element_text(color = "black"),
axis.title.x = element_text(margin = margin(t = 10)),
axis.title.y = element_text(margin = margin(r = 10))))
(connNet_mod %>%
ggplot(aes(x = nettype, y = mconnz, color = method)) +
geom_bar(stat = "summary", fun = "mean", fill = "white",
position = position_dodge(width = .95),
size = 1.01) +
geom_errorbar(aes(ymin = mean-se, ymax = mean+se),
stat = "identity", width = .2, size = .7,
position = position_dodge(width = .95)) +
geom_point(aes(y = mconnz, fill = method),
stat = "identity", alpha = .3, size = 2,
position = position_jitterdodge(jitter.width = .3,
dodge.width = .95)) +
scale_color_brewer(type = "qual", palette = "Dark2") +
theme(text = element_text(size = 30),
axis.text = element_text(color = "black")))
# ggsave("figures/connNet.pdf",
# fig_connNet, dpi = 300,
# width = 8, height = 5, units = "in")
Figure 5B. Bar plot showing the within - between differences in connectiviy for each method (i.e., plotting the interaction)
connNet_mod2 <- connNet_mod %>%
select(-mean,-se) %>%
pivot_wider(names_from = nettype,
values_from = mconnz) %>%
group_by(sbjs, method) %>%
mutate(diff = within - between) %>%
group_by(method) %>%
mutate(mean = mean(diff),
se = lurr::se(diff),
method = fct_relevel(method,
c("lpf","rest","resid")))
colorlabs <- c("#1b9e77","#666666","#d95f02")
(fig_connNetDiff <- connNet_mod2 %>%
ggplot(aes(x = method, y = diff, color = method)) +
geom_bar(stat = "summary", fun = "mean",
fill = "white", size = 1.01) +
geom_errorbar(aes(ymin = mean-se, ymax = mean+se),
stat = "identity", width = .2) +
geom_point(aes(fill = method), stat = "identity",
size = 2, alpha = .3,
position = position_jitter(width = .2)) +
#scale_color_brewer(type = "qual", palette = "Set1") +
scale_color_manual(values = colorlabs) +
labs(x = "Connectivity Method",
y = "Within - Between\nNetwork Connectivity") +
theme(legend.position = "none",
text = element_text(size = 24),
axis.text = element_text(color = "black"),
axis.title.x = element_text(margin = margin(t = 10)),
axis.title.y = element_text(margin = margin(r = 10))) +
scale_x_discrete(labels = c("LPF","Rest","FIR")))
# ggsave("figures/connNetDiff.pdf",
# fig_connNetDiff, dpi = 300,
# width = 6, height = 5, units = "in")
To test whether differences between the connectivity methods differ by network, we will conduct an exploratory 3 (method) x 28 (7 within-network connectivity estimates, 21 between-network connectivity estimates) repeated measures ANOVA.
# # Conduct Omnibus ANOVA for within-network connections
# (comp_connNetAllWtn <- aov_ez(data = filter(connNetAll, nettype=="within"),
# id = "sbjs",
# dv = "mconnz",
# within = c("method","netconn")))
#
# summary(comp_connNetAllWtn)
#
# # Estimated Marginal Means
# ### Method x Network-Connection Interaction
# (method_netconn_wtn.emm <- emmeans(comp_connNetAllWtn, c("method","netconn")))
# # afex_plot(comp_connNetAllWtn,
# # x = "netconn", trace = "method",
# # mapping = "color", error = "within")
#
#
# (fig_connNetAllWtn <- connNetAll_sum %>%
# filter(nettype == "within") %>%
# ggplot(aes(x = netconn, y = mean, fill = method)) +
# geom_bar(stat = "identity", color = "white",
# position = position_dodge(width = .9)) +
# geom_errorbar(aes(ymin = mean-se, ymax = mean+se),
# width = .2,
# position = position_dodge(width = .9)) +
# geom_point(data = filter(connNetAll, nettype=="within"),
# aes(x = netconn, y = mconnz),
# size = 1, alpha = .2,
# position = position_jitterdodge(dodge.width = .9,
# jitter.width = .2)) +
# scale_fill_brewer(type = "qual", palette = "Dark2") +
# theme(axis.text.y = element_text(color = "black", size = 16)))
#
# ggsave("figures/connNetAllWtn.pdf",
# fig_connNetAllWtn, dpi = 300,
# width = 10, height = 4.5, units = "in")
# # Conduct Omnibus ANOVA for between-network connections
# (comp_connNetAllBtw <- aov_ez(data = filter(connNetAll, nettype=="between"),
# id = "sbjs",
# dv = "mconnz",
# within = c("method","netconn")))
#
# summary(comp_connNetAllBtw)
#
# # Estimated Marginal Means
# ### Method x Network-Connection Interaction
# (method_netconn_btw.emm <- emmeans(comp_connNetAllBtw, c("method","netconn")))
# # afex_plot(comp_connNetAllWtn,
# # x = "netconn", trace = "method",
# # mapping = "color", error = "within")
#
# (fig_connNetAllBtw <- connNetAll_sum %>%
# filter(nettype == "between") %>%
# ggplot(aes(x = netconn, y = mean, fill = method)) +
# geom_bar(stat = "identity", color = "white",
# position = position_dodge(width = .9)) +
# geom_errorbar(aes(ymin = mean-se, ymax = mean+se),
# width = .2,
# position = position_dodge(width = .9)) +
# geom_point(data = filter(connNetAll, nettype=="between"),
# aes(x = netconn, y = mconnz),
# size = .5, alpha = .1,
# position = position_jitterdodge(dodge.width = .9,
# jitter.width = .2)) +
# theme(axis.text = element_text(angle = 45)))
#
# ggsave("figures/connNetAllBtw.pdf",
# fig_connNetAllBtw, dpi = 300,
# width = 10, height = 6, units = "in")
# Conduct Omnibus ANOVA for within-network connections
(comp_connNetAll <- aov_ez(data = connNetAll,
id = "sbjs",
dv = "mconnz",
within = c("method","netconn")))
## Anova Table (Type 3 tests)
##
## Response: mconnz
## Effect df MSE F ges p.value
## 1 method 1.42, 78.16 0.00 146.44 *** .012 <.001
## 2 netconn 7.99, 439.22 0.06 383.47 *** .812 <.001
## 3 method:netconn 12.14, 667.66 0.02 23.28 *** .135 <.001
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
##
## Sphericity correction method: GG
Conduct paired samples t-test to compare each background connectivity network to the rest network
connNetAll_wide <- connNetAll %>%
pivot_wider(names_from = method,
values_from = mconnz)
netconns <- unique(connNetAll_wide$netconn)
comp_MethodsxNetworks <- map_dfr(netconns, ~{
lpf_v_rest <- connNetAll_wide %>%
filter(netconn == .x) %$%
t.test(lpf, rest) %>%
broom::tidy() %>%
mutate(netconn = .x,
comparison = "lpf_rest") %>%
select(comparison, netconn, everything())
resid_v_rest <- connNetAll_wide %>%
filter(netconn == .x) %$%
t.test(resid, rest) %>%
broom::tidy() %>%
mutate(netconn = .x,
comparison = "resid_rest") %>%
select(comparison, netconn, everything())
lpf_v_resid <- connNetAll_wide %>%
filter(netconn == .x) %$%
t.test(lpf, resid) %>%
broom::tidy() %>%
mutate(netconn = .x,
comparison = "lpf_resid") %>%
select(comparison, netconn, everything())
rbind(lpf_v_rest,
resid_v_rest,
lpf_v_resid)
}) %>%
separate(netconn, c("net1","net2")) %>%
mutate(across(where(is.numeric), round, digits = 3),
nettype = ifelse(net1==net2,"within","between")) %>%
ungroup() %>%
arrange(desc(statistic)) %>%
arrange(comparison) %>%
print()
## # A tibble: 84 × 14
## comparison net1 net2 estimate estimate1 estimate2 statistic p.value
## <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 lpf_resid salventattn salven… 0.161 0.443 0.282 8.06 0
## 2 lpf_resid sommot sommot 0.187 0.59 0.403 6.93 0
## 3 lpf_resid vis vis 0.16 0.546 0.386 6.03 0
## 4 lpf_resid default default 0.097 0.33 0.233 6.03 0
## 5 lpf_resid dorsattn dorsat… 0.132 0.444 0.312 4.76 0
## 6 lpf_resid limbic limbic 0.107 0.291 0.184 4.69 0
## 7 lpf_resid default limbic 0.07 0.212 0.142 4.38 0
## 8 lpf_resid cont cont 0.067 0.274 0.207 4.11 0
## 9 lpf_resid salventattn dorsat… 0.076 0.199 0.124 3.44 0.001
## 10 lpf_resid salventattn sommot 0.069 0.198 0.129 3.16 0.002
## # … with 74 more rows, and 6 more variables: parameter <dbl>, conf.low <dbl>,
## # conf.high <dbl>, method <chr>, alternative <chr>, nettype <chr>
For each connection, we will calculate the across subject correlations in connectivity estimates obtained by each of three methods. For example, for l_vis1xl_vis2, would would correlate the subject estimates from the resting state scan with subject estimates from the lpf scans.
Using the fisher z transformed correlations
corrIDs <- df_meltz %>%
ungroup() %>%
unite(col = "connection", c("roi1","roi2"), sep = "-") %>%
unite(col = "netconn", c("net1","net2")) %>%
pivot_wider(names_from = method,
values_from = connz) %>%
group_by(connection, netconn, nettype) %>%
summarize(rest_lpf = cor(rest, lpf, method = "spearman"),
#rest_lpf_n = n(),
rest_resid = cor(rest, resid, method = "spearman"),
#rest_resid_n = n(),
lpf_resid = cor(lpf, resid, method = "spearman"),
#lpf_resid_n = n(),
.groups = "keep") %>%
separate(col = connection, into = c("roi1","roi2"), sep = "-") %>%
separate(col = netconn, into = c("net1","net2"))
corrIDs_long <- corrIDs %>%
pivot_longer(cols = c(6:8),
names_to = "comparison",
values_to = "rho")
Visualize the across-subject correlations for each connection
comparison <- c("rest_lpf","rest_resid","lpf_resid")
walk(comparison, ~{
# filter out correlations for the comparison
tmp_lower <- corrIDs_long %>%
ungroup() %>%
filter(comparison == .x)
# duplicate values for the upper triangle
tmp_upper <- tmp_lower %>%
rename(roi1 = roi2,
roi2 = roi1)
# combine upper/lower triangles into single df
tmp <- rbind(tmp_lower, tmp_upper) %>%
select(roi1, roi2, rho) %>%
mutate(roi1 = fct_relevel(roi1, rois$roi),
roi2 = fct_relevel(roi2, rois$roi)) %>%
arrange(roi1)
# cast df into a 100x100 matrix
tmp_mat <- acast(data = tmp,
roi1~roi2,
value.var = "rho")
# plot matrix
tmp_fig <- ggcorrplot(tmp_mat,
method = "square",
outline.color = FALSE,
lab = FALSE,
tl.cex = 5,
title = .x)
# ggsave(str_c("figures/corrIDs_", .x, ".pdf"),
# tmp_fig, dpi = 300,
# width = 8, height = 8)
})
Summarize the across-subject correlations for each connection (RAW CORRELATIONS)
corrIDs_sum <- corrIDs %>%
ungroup() %>%
select(6:8) %>%
psych::describe() %>%
print()
## vars n mean sd median trimmed mad min max range skew
## rest_lpf 1 4950 0.30 0.16 0.30 0.30 0.17 -0.31 0.77 1.08 -0.09
## rest_resid 2 4950 0.40 0.17 0.41 0.40 0.18 -0.25 0.84 1.08 -0.18
## lpf_resid 3 4950 0.72 0.09 0.73 0.73 0.09 0.32 0.93 0.61 -0.66
## kurtosis se
## rest_lpf -0.22 0
## rest_resid -0.28 0
## lpf_resid 0.45 0
Figure 6A. OPTION 1 Create density plot showing distribution of the individual differences correlations across all of the 100x100 [unique, obviously] connections Plotting the raw correlations between the methods
colorlabs <- c("#1b9e77","#d95f02","#666666")
(fig_corrIDs_allcon_densityplot <- corrIDs_long %>%
mutate(comparison = fct_relevel(comparison,
"rest_lpf",
"rest_resid",
"lpf_resid")) %>%
ggplot(aes(x = rho, y = comparison, fill = comparison)) +
geom_density_ridges(alpha = .6, scale = 5,
quantile_lines = TRUE, quantiles = 2) +
scale_fill_manual(values = colorlabs) +
theme(legend.position = "none",
text = element_text(size = 30),
axis.text = element_text(color = "black"),
axis.title.x = element_text(margin = margin(t = 10)),
axis.title.y = element_text(margin = margin(r = 10))) +
scale_y_discrete(labels = c("RestxLPF","RestxFIR","LPFxFIR")) +
labs(x = "Spearman's rho", y = "Comparison") )
## Picking joint bandwidth of 0.0232
ggsave(filename = "figures/corrIDs_allcons_density.pdf",
plot = fig_corrIDs_allcon_densityplot, dpi = 300,
width = 7, height = 6)
## Picking joint bandwidth of 0.0232
Figure 6A. OPTION 2 Create boxplot showing distribution of the individual differences correlations across all of the 100x100 [unique, obviously] connections Plotting the raw correlations between the methods
colorlabs <- c("#1b9e77","#d95f02","#666666")
(fig_corrIDs_allcons_boxplot <- corrIDs_long %>%
mutate(comparison = fct_relevel(comparison,
"rest_lpf",
"rest_resid",
"lpf_resid")) %>%
ggplot(aes(x = comparison, y = rho, color = comparison)) +
geom_boxplot(size = 1.1) +
scale_color_manual(values = colorlabs) +
scale_fill_manual(values = colorlabs) +
theme(legend.position = "none",
text = element_text(size = 30),
axis.text = element_text(color = "black"),
axis.title.x = element_text(margin = margin(t = 10)),
axis.title.y = element_text(margin = margin(r = 10))) +
labs(x = "Comparison", y = "Reliability (rho)") +
scale_x_discrete(labels = c("RestxLPF","RestxFIR","LPFxFIR")))
ggsave(filename = "figures/corrIDs_allcons_boxplot.pdf",
plot = fig_corrIDs_allcons_boxplot, dpi = 300,
width = 7, height = 6)
Figure 6B. Plot and calculate the correlation between methods to see if those connections that were most similar between rest and resid were also most similar between rest and lpf. Plotting the raw correlations between the methods, but calculating the correlation test with the z-transformed correlatios
# need to convert to Fisher z
corrIDs <- corrIDs %>%
mutate(rest_lpfz = fisherz(rest_lpf),
rest_residz = fisherz(rest_resid))
cor.test(corrIDs$rest_lpfz, corrIDs$rest_residz)
##
## Pearson's product-moment correlation
##
## data: corrIDs$rest_lpfz and corrIDs$rest_residz
## t = 113.27, df = 4948, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.8415656 0.8570826
## sample estimates:
## cor
## 0.8495077
fig_compCorrIDs <- corrIDs %>%
ggplot(aes(x = rest_lpf, y = rest_resid)) +
geom_point(stat = "identity", alpha = .3,
color = "gray35") +
# geom_smooth(method = "lm", color = "black") +
theme(text = element_text(size = 30),
axis.text = element_text(color = "black"),
axis.title.x = element_text(margin = margin(t = 10)),
axis.title.y = element_text(margin = margin(r = 10))) +
# xlim(c(.3,1)) +
# ylim(c(.3,1)) +
labs(x = "Rest x LPF Reliability (rho)",
y = "Rest x FIR Reliability (rho)") +
geom_abline(slope = 1, color = "black",
linetype = "dashed", size = 1)
(fig_compCorrIDs <- ggMarginal(fig_compCorrIDs, data = corrIDs, type = "density",
xparams = list(fill = "#1B9E77", alpha = .75),
yparams = list(fill = "#D95F02", alpha = .75)))
ggsave("figures/corrIDs_allcon_scatter.pdf",
fig_compCorrIDs, dpi = 300,
width = 7, height = 6)
Plot the correlations for a few of the connections to see if there are any outliers - NOPE
# samp_conn <- corrIDs_long %>%
# unite(col = "connection", c(roi1, roi2)) %>%
# pull(connection) %>%
# unique() %>%
# sample(size = 3, replace = FALSE)
#
# corrID_examples_restVlpf <- df_meltz %>%
# ungroup() %>%
# unite(col = "connection", c(roi1, roi2)) %>%
# filter(connection %in% samp_conn) %>%
# pivot_wider(names_from = method,
# values_from = connz) %>%
# ggplot(aes(x = lpf, y = rest)) +
# geom_point(size = .5) +
# geom_smooth(method = "lm", size = .5) +
# facet_wrap(~connection, nrow = 1) +
# theme_minimal(base_size = 8)
#
# corrID_examples_restVresid <- df_meltz %>%
# ungroup() %>%
# unite(col = "connection", c(roi1, roi2)) %>%
# filter(connection %in% samp_conn) %>%
# pivot_wider(names_from = method,
# values_from = connz) %>%
# ggplot(aes(x = resid, y = rest)) +
# geom_point(size = .5) +
# geom_smooth(method = "lm", size = .5) +
# facet_wrap(~connection, nrow = 1) +
# theme_minimal(base_size = 8)
#
# corrID_examples_residVlpf <- df_meltz %>%
# ungroup() %>%
# unite(col = "connection", c(roi1, roi2)) %>%
# filter(connection %in% samp_conn) %>%
# pivot_wider(names_from = method,
# values_from = connz) %>%
# ggplot(aes(x = lpf, y = resid)) +
# geom_point(size = .5) +
# geom_smooth(method = "lm", size = .5) +
# facet_wrap(~connection, nrow = 1) +
# theme_minimal(base_size = 8)
#
# gridExtra::grid.arrange(corrID_examples_restVlpf,
# corrID_examples_restVresid,
# corrID_examples_residVlpf)
Calculate the across-subject correlations for each network
# This correlates the single connections and then averages within network-network connections
# corrIDs_long_bynet <- corrIDs_long %>%
# unite(col = "netconn", c(net1, net2)) %>%
# group_by(netconn, nettype, comparison) %>%
# summarize(mrho = mean(rho),
# .groups = "keep") %>%
# separate(col = netconn, c("net1","net2"))
# This will average connections within network-network connections and then correlate b/w methods
corrIDs_bynet <- connNetAll %>%
pivot_wider(names_from = method,
values_from = mconnz) %>%
group_by(netconn, nettype) %>%
summarize(rest_lpf = cor(rest, lpf, method = "spearman"),
#rest_lpf_n = n(),
rest_resid = cor(rest, resid, method = "spearman"),
#rest_resid_n = n(),
lpf_resid = cor(lpf, resid, method = "spearman"),
#lpf_resid_n = n(),
.groups = "keep")
corrIDs_bynet_long <- corrIDs_bynet %>%
ungroup() %>%
separate(col = netconn,
into = c("net1","net2")) %>%
pivot_longer(cols = c(4:6),
names_to = "comparison",
values_to = "rho")
Summarize the across-subject correlations for each network-network connection (using the RAW correlations)
corrIDs_bynet %>%
ungroup() %>%
select(rest_lpf, rest_resid, lpf_resid) %>%
psych::describe()
Compare the reliability of individual differences between RestxLPF and RestxResid Using the z-transformed correlations!
corrIDs_bynet <- corrIDs_bynet %>%
mutate(rest_lpfz = fisherz(rest_lpf),
rest_residz = fisherz(rest_resid))
broom::tidy(t.test(x = corrIDs_bynet$rest_lpfz,
y = corrIDs_bynet$rest_residz,
paired = TRUE)) %>%
mutate(across(where(is.numeric), round, digits = 3))
t.test(x = corrIDs_bynet$rest_lpfz,
y = corrIDs_bynet$rest_residz,
paired = TRUE)
##
## Paired t-test
##
## data: corrIDs_bynet$rest_lpfz and corrIDs_bynet$rest_residz
## t = -7.9304, df = 27, p-value = 1.592e-08
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.1813862 -0.1068186
## sample estimates:
## mean of the differences
## -0.1441024
corrIDs_bynet %>%
ungroup() %>%
select(netconn, rest_lpfz, rest_residz) %>%
pivot_longer(cols = c(2:3),
names_to = "comparison",
values_to = "rz") %$%
lsr::cohensD(rz ~ comparison, method = "paired")
## Warning in lsr::cohensD(rz ~ comparison, method = "paired"): calculating paired
## samples Cohen's d using formula input. Results will be incorrect if cases do not
## appear in the same order for both levels of the grouping factor
## [1] 1.498696
Plot the correlations for all network-network connections
df_meltz_wide <- df_meltz %>%
ungroup() %>%
unite(col = "netconn",
c(net1, net2)) %>%
group_by(sbjs, method, netconn) %>%
summarize(mconnz = mean(connz),
.groups = "keep") %>%
pivot_wider(names_from = method,
values_from = mconnz)
# REST x LPF
corrID_restxlpf_corrplots <- df_meltz_wide %>%
ggplot(aes(x = rest, y = lpf)) +
geom_point(size = .75, alpha = .5) +
geom_smooth(method = "lm", size = .75) +
facet_wrap(~netconn, nrow = 4, scales = "free")
ggsave(filename = "figures/corrIDs_bynet_corrplots_restxlpf.pdf",
plot = corrID_restxlpf_corrplots,
width = 15, height = 9)
## `geom_smooth()` using formula 'y ~ x'
# REST x RESID
corrID_restxresid_corrplots <- df_meltz_wide %>%
ggplot(aes(x = rest, y = resid)) +
geom_point(size = .75, alpha = .5) +
geom_smooth(method = "lm", size = .75) +
facet_wrap(~netconn, nrow = 4, scales = "free")
# ggsave(filename = "figures/corrIDs_bynet_corrplots_restxresid.pdf",
# plot = corrID_restxresid_corrplots,
# width = 15, height = 9)
# LPF x RESID
corrID_lpfxresid_corrplots <- df_meltz_wide %>%
ggplot(aes(x = lpf, y = resid)) +
geom_point(size = .75, alpha = .5) +
geom_smooth(method = "lm", size = .75) +
facet_wrap(~netconn, nrow = 4, scales = "free")
# ggsave(filename = "figures/corrIDs_bynet_corrplots_lpfxresid.pdf",
# plot = corrID_lpfxresid_corrplots,
# width = 15, height = 9)
Plot the correlations for highest and lowest correlations for each comparison
#
# ## REST x LPF ##
# # Find the largest and smallest correlation
# max_netconn <- corrIDs_bynet %>%
# ungroup() %>%
# slice_max(order_by = rest_lpf) %>%
# pull(netconn)
#
# min_netconn <- corrIDs_bynet %>%
# ungroup() %>%
# slice_min(order_by = rest_lpf) %>%
# pull(netconn)
#
# max_plot <- df_meltz_wide %>%
# filter(netconn == max_netconn) %>%
# ggplot(aes(x = rest, y = lpf)) +
# geom_point(alpha = .3, size = 5) +
# geom_smooth(method = "lm", color = "black", size = 3) +
# labs(x = "Rest", y = "Low-pass filter",
# title = "Default-Limbic") +
# theme_minimal(base_size = 40) +
# theme(axis.text = element_text(color = "black"),
# plot.title = element_text(hjust = .5))
#
# ggsave(filename = "figures/corrID_bynet_maxplot_restxlpf.pdf",
# plot = max_plot, width = 8, height = 8, dpi = 300)
#
# min_plot <- df_meltz_wide %>%
# filter(netconn == min_netconn) %>%
# ggplot(aes(x = rest, y = lpf)) +
# geom_point(alpha = .3, size = 5) +
# geom_smooth(method = "lm", color = "black", size = 3) +
# labs(x = "Rest", y = "Low-pass filter",
# title = "Default-Visual") +
# theme_minimal(base_size = 40) +
# theme(axis.text = element_text(color = "black"),
# plot.title = element_text(hjust = .5))
#
# ggsave(filename = "figures/corrID_bynet_minplot_restxlpf.pdf",
# plot = min_plot, width = 8, height = 8, dpi = 300)
#
# ## REST x RESID ##
# # Find the largest and smallest correlation
# max_netconn <- corrIDs_bynet %>%
# ungroup() %>%
# slice_max(order_by = rest_resid) %>%
# pull(netconn)
#
# min_netconn <- corrIDs_bynet %>%
# ungroup() %>%
# slice_min(order_by = rest_resid) %>%
# pull(netconn)
#
# max_plot <- df_meltz_wide %>%
# filter(netconn == max_netconn) %>%
# ggplot(aes(x = rest, y = resid)) +
# geom_point(alpha = .3, size = 5) +
# geom_smooth(method = "lm", color = "black", size = 3) +
# labs(x = "Rest", y = "Residual",
# title = "Default-Limbic") +
# theme_minimal(base_size = 40) +
# theme(axis.text = element_text(color = "black"),
# plot.title = element_text(hjust = .5))
#
# ggsave(filename = "figures/corrID_bynet_maxplot_restxresid.pdf",
# plot = max_plot, width = 8, height = 8, dpi = 300)
#
# min_plot <- df_meltz_wide %>%
# filter(netconn == min_netconn) %>%
# ggplot(aes(x = rest, y = resid)) +
# geom_point(alpha = .3, size = 5) +
# geom_smooth(method = "lm", color = "black", size = 3) +
# labs(x = "Rest", y = "Residual",
# title = "Dorsal Attn-Visual") +
# theme_minimal(base_size = 40) +
# theme(axis.text = element_text(color = "black"),
# plot.title = element_text(hjust = .5))
#
# ggsave(filename = "figures/corrID_bynet_minplot_restxresid.pdf",
# plot = min_plot, width = 8, height = 8, dpi = 300)
Plot the across-subject correlations for each network-network connection
comparison <- c("rest_lpf","rest_resid","lpf_resid")
network_order <- c("default","cont","limbic","salventattn",
"dorsattn","sommot","vis")
walk(comparison, ~ {
# filter out correlations for the comparison
tmp_lower <- corrIDs_bynet_long %>%
ungroup() %>%
filter(comparison == .x)
# duplicate values for the upper triangle
tmp_upper <- tmp_lower %>%
filter(nettype == "between") %>%
rename(net1 = net2,
net2 = net1)
# combine upper/lower triangles into single df
tmp <- rbind(tmp_lower, tmp_upper) %>%
select(net1, net2, rho) %>%
mutate(net1 = fct_relevel(net1, rev(network_order)),
net2 = fct_relevel(net2, rev(network_order))) %>%
arrange(net1)
# cast df into a 100x100 matrix
tmp_mat <- acast(data = tmp,
net1~net2,
value.var = "rho")
# plot matrix
tmp_fig <- ggcorrplot(tmp_mat,
method = "square",
outline.color = FALSE,
lab = TRUE,
legend.title = "Rho",
title = .x) +
scale_fill_gradient(limit = c(0, 1),
low = "white", high = "red",
name = "Rho")
# ggsave(str_c("figures/corrIDs_byNet_fix_", .x, ".pdf"),
# tmp_fig, dpi = 300,
# width = 7, height = 6, units = "in")
})
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
Individual differences using the background connectivity methods are not as correlated with those found in the resting state data. To get a picture of what’s going on we want to know if individual differences in background connectivity during the task are tracking behavior.
corrBehav <- df_meltz %>%
ungroup() %>%
unite(col = "netconn",
c(net1, net2)) %>%
group_by(sbjs, method, netconn) %>%
summarize(mconnz = mean(connz),
.groups = "keep") %>%
ungroup() %>%
left_join(behav, by = c("sbjs" = "ssid")) %>%
group_by(method, netconn) %>%
summarize(corr_cat_old = cor(mconnz, facat_acc_cat_old,
method = "spearman", use = "pairwise.complete.obs"),
corr_cat_new = cor(mconnz, facat_acc_cat_new,
method = "spearman", use = "pairwise.complete.obs"),
corr_recog_chr = cor(mconnz, facat_acc_recog_chr,
method = "spearman", use = "pairwise.complete.obs"),
.groups = "keep")
# Plot distribution of correlations
corrBehav %>%
ggplot(aes(x = method, y = corr_cat_old, fill = method)) +
geom_boxplot() +
theme(legend.position = "none")
corrBehav %>%
ggplot(aes(x = method, y = corr_cat_new, fill = method)) +
geom_boxplot() +
theme(legend.position = "none")
corrBehav %>%
ggplot(aes(x = method, y = corr_recog_chr, fill = method)) +
geom_boxplot() +
theme(legend.position = "none")
For each method, plot the correlation between each of the 28 network-network connections and behavior
avgNetconn <- df_meltz %>%
ungroup() %>%
unite(col = "netconn",
c(net1, net2)) %>%
group_by(sbjs, method, netconn) %>%
summarize(mconnz = mean(connz),
.groups = "keep")
avgNetconnBehav <- left_join(avgNetconn, behav, by = c("sbjs" = "ssid")) %>%
left_join(corrBehav) %>%
mutate(across(contains("corr"), round, digits = 2)) %>%
mutate(netconn_catold = str_c(netconn, ", r = ", corr_cat_old),
netconn_catnew = str_c(netconn, ", r = ", corr_cat_new),
netconn_recog = str_c(netconn, ", r = ", corr_recog_chr))
## Joining, by = c("method", "netconn")
walk(method, ~{
# # Troubleshoot
# .x <- methods[1]
p1 <- avgNetconnBehav %>%
filter(method == .x) %>%
ggplot(aes(x = mconnz, y = facat_acc_cat_old)) +
geom_point(size = .75, alpha = .5) +
geom_smooth(method = "lm", size = .75) +
facet_wrap(~netconn_catold, nrow = 4, scales = "free") +
theme_minimal(base_size = 10)
ggsave(plot = p1,
filename = str_c("figures/corr_behav_", .x, "_catOld.pdf"),
height = 9, width = 15)
p2 <- avgNetconnBehav %>%
filter(method == .x) %>%
ggplot(aes(x = mconnz, y = facat_acc_cat_new)) +
geom_point(size = .75, alpha = .5) +
geom_smooth(method = "lm", size = .75) +
facet_wrap(~netconn_catnew, nrow = 4, scales = "free") +
theme_minimal(base_size = 10)
ggsave(plot = p2,
filename = str_c("figures/corr_behav_", .x, "_catNew.pdf"),
height = 9, width = 15)
p3 <- avgNetconnBehav %>%
filter(method == .x) %>%
ggplot(aes(x = mconnz, y = facat_acc_recog_chr)) +
geom_point(size = .75, alpha = .5) +
geom_smooth(method = "lm", size = .75) +
facet_wrap(~netconn_recog, nrow = 4, scales = "free") +
theme_minimal(base_size = 10)
ggsave(plot = p3,
filename = str_c("figures/corr_behav_", .x, "_recogCHR.pdf"),
height = 9, width = 15)
})
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 28 rows containing non-finite values (stat_smooth).
## Warning: Removed 28 rows containing missing values (geom_point).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 28 rows containing non-finite values (stat_smooth).
## Warning: Removed 28 rows containing missing values (geom_point).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 28 rows containing non-finite values (stat_smooth).
## Warning: Removed 28 rows containing missing values (geom_point).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 28 rows containing non-finite values (stat_smooth).
## Warning: Removed 28 rows containing missing values (geom_point).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 28 rows containing non-finite values (stat_smooth).
## Warning: Removed 28 rows containing missing values (geom_point).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 28 rows containing non-finite values (stat_smooth).
## Warning: Removed 28 rows containing missing values (geom_point).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 28 rows containing non-finite values (stat_smooth).
## Warning: Removed 28 rows containing missing values (geom_point).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 28 rows containing non-finite values (stat_smooth).
## Warning: Removed 28 rows containing missing values (geom_point).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 28 rows containing non-finite values (stat_smooth).
## Warning: Removed 28 rows containing missing values (geom_point).
How does each person’s pattern of connectivity predict behavior?
corrBehav_rest <- avgNetconn %>%
ungroup() %>%
pivot_wider(names_from = netconn,
values_from = mconnz) %>%
filter(method == "rest") %>%
left_join(behav, by = c("sbjs" = "ssid")) %>%
select(-sbjs, -method) %>%
cor(use = "pairwise.complete")
ggcorrplot(corrBehav_rest,
method = "square",
outline.color = FALSE,
lab = TRUE,
title = "Rest",
lab_size = 2)
corrBehav_resid <- avgNetconn %>%
ungroup() %>%
pivot_wider(names_from = netconn,
values_from = mconnz) %>%
filter(method == "resid") %>%
left_join(behav, by = c("sbjs" = "ssid")) %>%
select(-sbjs, -method) %>%
cor(use = "pairwise.complete")
ggcorrplot(corrBehav_resid,
method = "square",
outline.color = FALSE,
lab = TRUE,
title = "Residual",
lab_size = 2)
corrBehav_lpf <- avgNetconn %>%
ungroup() %>%
pivot_wider(names_from = netconn,
values_from = mconnz) %>%
filter(method == "lpf") %>%
left_join(behav, by = c("sbjs" = "ssid")) %>%
select(-sbjs, -method) %>%
cor(use = "pairwise.complete")
ggcorrplot(corrBehav_lpf,
method = "square",
outline.color = FALSE,
lab = TRUE,
title = "Low-pass Filter",
lab_size = 2)
Since some predictors are highly correlated, going to use PCA to reduce the number of predictors
## PCA FOR REST CONNECTIVITY ##
# get rest connections
restConn <- avgNetconn %>%
pivot_wider(names_from = netconn,
values_from = mconnz) %>%
filter(method == "rest")
# scale connectivity
restConn <- scale(restConn[,-1:-2])
# run pca
# 7 eigenvalues greater than 1
(pca_rest <- principal(restConn, nfactors = 8,
rotate = "oblimin", use = "pairwise",
scores = TRUE))
## Loading required namespace: GPArotation
## Warning in principal(restConn, nfactors = 8, rotate = "oblimin", use =
## "pairwise", : I am sorry, to do these rotations requires the GPArotation package
## to be installed
## Principal Components Analysis
## Call: principal(r = restConn, nfactors = 8, rotate = "oblimin", scores = TRUE,
## use = "pairwise")
## Standardized loadings (pattern matrix) based upon correlation matrix
## TC1 TC2 TC3 TC4 TC5 TC6 TC7 TC8 h2
## cont_cont -0.11 0.30 0.12 0.52 -0.02 -0.26 -0.19 0.61 0.87
## cont_dorsattn -0.08 -0.69 0.16 0.01 0.04 0.25 0.18 0.44 0.80
## cont_limbic -0.14 0.80 -0.18 -0.06 -0.14 0.10 0.22 -0.05 0.78
## cont_salventattn -0.05 -0.33 0.62 0.26 0.34 -0.10 -0.29 0.00 0.76
## cont_sommot 0.06 -0.45 0.45 -0.24 0.43 0.35 0.32 0.06 0.88
## cont_vis 0.11 -0.69 -0.42 -0.23 -0.24 -0.01 0.11 -0.20 0.83
## default_cont -0.09 0.88 0.12 0.00 0.02 -0.01 -0.08 -0.22 0.86
## default_default 0.76 0.25 0.23 0.16 0.09 -0.06 0.09 0.00 0.73
## default_dorsattn -0.76 0.10 -0.14 -0.50 -0.14 0.10 -0.17 0.17 0.94
## default_limbic 0.88 0.01 0.10 -0.20 0.00 0.26 -0.24 0.05 0.95
## default_salventattn -0.68 0.19 -0.05 0.32 0.12 0.47 -0.21 -0.17 0.91
## default_sommot -0.50 -0.23 0.63 -0.09 -0.44 0.11 -0.08 -0.12 0.93
## default_vis -0.62 -0.53 -0.29 -0.06 0.30 -0.19 -0.08 0.00 0.89
## dorsattn_dorsattn 0.38 0.02 0.24 0.64 0.17 0.11 0.30 -0.18 0.78
## dorsattn_sommot 0.37 0.13 -0.44 0.14 0.42 0.15 0.00 0.06 0.57
## dorsattn_vis 0.79 0.02 0.02 0.35 -0.14 -0.06 -0.01 -0.24 0.83
## limbic_dorsattn -0.81 0.25 -0.11 -0.18 0.00 -0.11 0.19 0.04 0.81
## limbic_limbic 0.57 -0.19 0.08 -0.31 0.04 0.35 -0.53 -0.01 0.87
## limbic_salventattn -0.69 0.39 0.05 0.40 -0.02 0.17 0.14 0.11 0.85
## limbic_sommot -0.43 -0.12 0.70 0.16 -0.34 -0.05 0.10 -0.08 0.85
## limbic_vis -0.53 -0.35 -0.13 0.15 0.36 -0.50 -0.10 -0.19 0.86
## salventattn_dorsattn 0.50 -0.30 0.42 -0.02 -0.13 -0.38 0.06 0.19 0.71
## salventattn_salventattn 0.33 0.20 0.38 -0.47 -0.05 -0.50 0.06 -0.12 0.79
## salventattn_sommot 0.27 0.38 -0.13 -0.48 0.55 -0.06 0.29 0.09 0.86
## salventattn_vis 0.41 -0.28 -0.52 -0.02 -0.56 0.08 0.25 0.15 0.93
## sommot_sommot 0.15 0.55 -0.21 -0.19 -0.06 -0.21 -0.26 0.16 0.55
## sommot_vis 0.29 -0.06 -0.57 0.54 -0.15 -0.08 -0.07 0.04 0.74
## vis_vis 0.18 0.68 0.49 -0.18 -0.05 0.15 0.09 0.16 0.82
## u2 com
## cont_cont 0.133 3.3
## cont_dorsattn 0.203 2.4
## cont_limbic 0.220 1.4
## cont_salventattn 0.235 3.2
## cont_sommot 0.116 5.3
## cont_vis 0.170 2.6
## default_cont 0.142 1.2
## default_default 0.267 1.6
## default_dorsattn 0.062 2.3
## default_limbic 0.053 1.5
## default_salventattn 0.092 3.0
## default_sommot 0.071 3.3
## default_vis 0.109 3.3
## dorsattn_dorsattn 0.222 3.0
## dorsattn_sommot 0.428 3.7
## dorsattn_vis 0.170 1.7
## limbic_dorsattn 0.189 1.5
## limbic_limbic 0.126 3.6
## limbic_salventattn 0.150 2.7
## limbic_sommot 0.150 2.5
## limbic_vis 0.141 4.3
## salventattn_dorsattn 0.290 4.1
## salventattn_salventattn 0.213 4.2
## salventattn_sommot 0.137 4.2
## salventattn_vis 0.074 4.0
## sommot_sommot 0.449 2.9
## sommot_vis 0.262 2.8
## vis_vis 0.179 2.5
##
## TC1 TC2 TC3 TC4 TC5 TC6 TC7 TC8
## SS loadings 6.62 4.74 3.42 2.59 1.84 1.56 1.15 1.02
## Proportion Var 0.24 0.17 0.12 0.09 0.07 0.06 0.04 0.04
## Cumulative Var 0.24 0.41 0.53 0.62 0.69 0.74 0.78 0.82
## Proportion Explained 0.29 0.21 0.15 0.11 0.08 0.07 0.05 0.04
## Cumulative Proportion 0.29 0.50 0.64 0.76 0.84 0.91 0.96 1.00
##
## Mean item complexity = 2.9
## Test of the hypothesis that 8 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.04
## with the empirical chi square 77.48 with prob < 1
##
## Fit based upon off diagonal values = 0.98
# plot(pca_rest$values)
# sum(pca_rest$values > 1)
print.psych(pca_rest, digits = 2, cut = .3, sort = TRUE) # run in console for better view
## Principal Components Analysis
## Call: principal(r = restConn, nfactors = 8, rotate = "oblimin", scores = TRUE,
## use = "pairwise")
## Standardized loadings (pattern matrix) based upon correlation matrix
## item TC1 TC2 TC3 TC4 TC5 TC6 TC7 TC8
## default_limbic 10 0.88
## limbic_dorsattn 17 -0.81
## dorsattn_vis 16 0.79 0.35
## default_default 8 0.76
## default_dorsattn 9 -0.76 -0.50
## limbic_salventattn 19 -0.69 0.39 0.40
## default_salventattn 11 -0.68 0.32 0.47
## default_vis 13 -0.62 -0.53 0.30
## limbic_limbic 18 0.57 -0.31 0.35 -0.53
## limbic_vis 21 -0.53 -0.35 0.36 -0.50
## salventattn_dorsattn 22 0.50 0.42 -0.38
## default_cont 7 0.88
## cont_limbic 3 0.80
## cont_dorsattn 2 -0.69 0.44
## cont_vis 6 -0.69 -0.42
## vis_vis 28 0.68 0.49
## sommot_sommot 26 0.55
## cont_sommot 5 -0.45 0.45 0.43 0.35 0.32
## limbic_sommot 20 -0.43 0.70 -0.34
## default_sommot 12 -0.50 0.63 -0.44
## cont_salventattn 4 -0.33 0.62 0.34
## sommot_vis 27 -0.57 0.54
## dorsattn_sommot 15 0.37 -0.44 0.42
## dorsattn_dorsattn 14 0.38 0.64 0.30
## salventattn_vis 25 0.41 -0.52 -0.56
## salventattn_sommot 24 0.38 -0.48 0.55
## salventattn_salventattn 23 0.33 0.38 -0.47 -0.50
## cont_cont 1 0.52 0.61
## h2 u2 com
## default_limbic 0.95 0.053 1.5
## limbic_dorsattn 0.81 0.189 1.5
## dorsattn_vis 0.83 0.170 1.7
## default_default 0.73 0.267 1.6
## default_dorsattn 0.94 0.062 2.3
## limbic_salventattn 0.85 0.150 2.7
## default_salventattn 0.91 0.092 3.0
## default_vis 0.89 0.109 3.3
## limbic_limbic 0.87 0.126 3.6
## limbic_vis 0.86 0.141 4.3
## salventattn_dorsattn 0.71 0.290 4.1
## default_cont 0.86 0.142 1.2
## cont_limbic 0.78 0.220 1.4
## cont_dorsattn 0.80 0.203 2.4
## cont_vis 0.83 0.170 2.6
## vis_vis 0.82 0.179 2.5
## sommot_sommot 0.55 0.449 2.9
## cont_sommot 0.88 0.116 5.3
## limbic_sommot 0.85 0.150 2.5
## default_sommot 0.93 0.071 3.3
## cont_salventattn 0.76 0.235 3.2
## sommot_vis 0.74 0.262 2.8
## dorsattn_sommot 0.57 0.428 3.7
## dorsattn_dorsattn 0.78 0.222 3.0
## salventattn_vis 0.93 0.074 4.0
## salventattn_sommot 0.86 0.137 4.2
## salventattn_salventattn 0.79 0.213 4.2
## cont_cont 0.87 0.133 3.3
##
## TC1 TC2 TC3 TC4 TC5 TC6 TC7 TC8
## SS loadings 6.62 4.74 3.42 2.59 1.84 1.56 1.15 1.02
## Proportion Var 0.24 0.17 0.12 0.09 0.07 0.06 0.04 0.04
## Cumulative Var 0.24 0.41 0.53 0.62 0.69 0.74 0.78 0.82
## Proportion Explained 0.29 0.21 0.15 0.11 0.08 0.07 0.05 0.04
## Cumulative Proportion 0.29 0.50 0.64 0.76 0.84 0.91 0.96 1.00
##
## Mean item complexity = 2.9
## Test of the hypothesis that 8 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.04
## with the empirical chi square 77.48 with prob < 1
##
## Fit based upon off diagonal values = 0.98
mean(pca_rest$communality) # want this above .7
## [1] 0.8195142
# get scores
comps_rest <- data.frame(pca_rest$scores) %>%
mutate(ssid = unique(avgNetconnBehav$sbjs)) %>%
left_join(behav) %>%
select(-ssid) %>%
rename(dorsattn_default = TC4,
vis_limdef = TC7,
sommot_other = TC3,
vis_ssc = TC5,
ventattn_other = TC6,
limbic_wtn_other = TC1,
control_other = TC2,
control_within = TC8)
## Joining, by = "ssid"
## PCA FOR RESID CONNECTIVITY ##
# get connections
residConn <- avgNetconn %>%
pivot_wider(names_from = netconn,
values_from = mconnz) %>%
filter(method == "resid")
# scale connectivity
residConn <- scale(residConn[,-1:-2])
# run pca
# 7 eigenvalues greater than 1
(pca_resid <- principal(residConn, nfactors = 8,
rotate = "oblimin", use = "pairwise",
scores = TRUE))
## Loading required namespace: GPArotation
## Warning in principal(residConn, nfactors = 8, rotate = "oblimin", use =
## "pairwise", : I am sorry, to do these rotations requires the GPArotation package
## to be installed
## Principal Components Analysis
## Call: principal(r = residConn, nfactors = 8, rotate = "oblimin", scores = TRUE,
## use = "pairwise")
## Standardized loadings (pattern matrix) based upon correlation matrix
## TC1 TC2 TC3 TC4 TC5 TC6 TC7 TC8 h2
## cont_cont 0.29 0.37 -0.04 0.16 -0.20 0.17 0.54 0.49 0.85
## cont_dorsattn -0.08 -0.58 -0.43 0.27 -0.26 -0.25 0.08 0.15 0.76
## cont_limbic 0.25 0.36 0.51 -0.06 -0.32 -0.33 0.17 -0.22 0.73
## cont_salventattn -0.20 0.03 -0.28 0.46 0.38 0.55 -0.07 0.07 0.79
## cont_sommot -0.02 -0.65 0.35 0.15 0.37 -0.39 0.01 0.13 0.88
## cont_vis -0.39 -0.63 0.00 -0.21 0.10 0.05 -0.33 -0.14 0.74
## default_cont 0.29 0.70 0.40 -0.09 -0.07 -0.19 -0.02 0.07 0.78
## default_default 0.84 -0.05 0.00 0.13 0.17 0.06 -0.17 -0.07 0.80
## default_dorsattn -0.85 0.19 0.00 -0.03 -0.36 -0.08 -0.22 0.03 0.95
## default_limbic 0.89 -0.11 -0.02 -0.08 -0.08 0.07 -0.30 0.16 0.94
## default_salventattn -0.71 0.42 0.26 -0.09 0.17 0.00 -0.06 0.32 0.89
## default_sommot -0.71 0.17 -0.23 0.38 0.06 -0.16 -0.02 0.13 0.78
## default_vis -0.64 -0.56 0.18 -0.09 -0.23 0.14 0.23 0.07 0.89
## dorsattn_dorsattn 0.70 -0.05 0.13 0.18 0.28 0.06 0.49 0.11 0.87
## dorsattn_sommot 0.15 -0.19 0.53 -0.26 0.09 0.56 -0.04 0.02 0.73
## dorsattn_vis 0.47 0.36 -0.18 -0.16 0.64 -0.02 -0.10 -0.09 0.84
## limbic_dorsattn -0.79 0.32 -0.02 0.04 -0.06 -0.04 0.11 -0.18 0.77
## limbic_limbic 0.53 -0.05 -0.16 -0.17 -0.31 0.16 -0.28 0.57 0.86
## limbic_salventattn -0.62 0.27 0.36 -0.03 0.34 -0.09 0.13 -0.06 0.73
## limbic_sommot -0.48 0.11 -0.56 0.21 0.28 -0.27 0.09 0.10 0.77
## limbic_vis -0.76 -0.24 0.09 0.04 -0.02 0.34 0.18 -0.14 0.81
## salventattn_dorsattn 0.61 -0.42 0.04 0.22 0.00 0.21 0.31 -0.21 0.78
## salventattn_salventattn 0.56 0.03 -0.12 0.45 -0.16 -0.15 -0.02 -0.33 0.69
## salventattn_sommot 0.51 -0.33 0.40 0.24 -0.27 -0.18 0.01 -0.02 0.70
## salventattn_vis 0.34 -0.06 -0.60 -0.50 -0.16 -0.26 0.19 -0.10 0.87
## sommot_sommot -0.13 0.42 -0.25 0.20 -0.44 0.52 -0.04 -0.29 0.85
## sommot_vis 0.44 0.22 -0.40 -0.60 0.11 0.10 0.24 -0.14 0.86
## vis_vis 0.58 0.46 0.06 0.49 -0.02 -0.03 -0.27 -0.04 0.87
## u2 com
## cont_cont 0.148 4.2
## cont_dorsattn 0.244 3.5
## cont_limbic 0.269 4.8
## cont_salventattn 0.208 3.7
## cont_sommot 0.124 3.2
## cont_vis 0.262 2.8
## default_cont 0.217 2.3
## default_default 0.202 1.2
## default_dorsattn 0.049 1.7
## default_limbic 0.064 1.4
## default_salventattn 0.113 2.6
## default_sommot 0.225 2.2
## default_vis 0.106 2.9
## dorsattn_dorsattn 0.132 2.5
## dorsattn_sommot 0.272 2.9
## dorsattn_vis 0.159 3.0
## limbic_dorsattn 0.228 1.5
## limbic_limbic 0.136 3.7
## limbic_salventattn 0.267 2.9
## limbic_sommot 0.233 3.6
## limbic_vis 0.192 1.9
## salventattn_dorsattn 0.220 3.3
## salventattn_salventattn 0.312 3.1
## salventattn_sommot 0.301 4.2
## salventattn_vis 0.127 3.6
## sommot_sommot 0.151 4.6
## sommot_vis 0.135 3.7
## vis_vis 0.128 3.4
##
## TC1 TC2 TC3 TC4 TC5 TC6 TC7 TC8
## SS loadings 8.50 3.62 2.53 1.98 1.88 1.76 1.33 1.19
## Proportion Var 0.30 0.13 0.09 0.07 0.07 0.06 0.05 0.04
## Cumulative Var 0.30 0.43 0.52 0.59 0.66 0.72 0.77 0.81
## Proportion Explained 0.37 0.16 0.11 0.09 0.08 0.08 0.06 0.05
## Cumulative Proportion 0.37 0.53 0.64 0.73 0.81 0.89 0.95 1.00
##
## Mean item complexity = 3
## Test of the hypothesis that 8 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.04
## with the empirical chi square 84.84 with prob < 1
##
## Fit based upon off diagonal values = 0.98
# plot(pca_resid$values)
# sum(pca_resid$values > 1)
print.psych(pca_resid, digits = 2, cut = .3, sort = TRUE) # run in console for better view
## Principal Components Analysis
## Call: principal(r = residConn, nfactors = 8, rotate = "oblimin", scores = TRUE,
## use = "pairwise")
## Standardized loadings (pattern matrix) based upon correlation matrix
## item TC1 TC2 TC3 TC4 TC5 TC6 TC7 TC8
## default_limbic 10 0.89 -0.30
## default_dorsattn 9 -0.85 -0.36
## default_default 8 0.84
## limbic_dorsattn 17 -0.79 0.32
## limbic_vis 21 -0.76 0.34
## default_sommot 12 -0.71 0.38
## default_salventattn 11 -0.71 0.42 0.32
## dorsattn_dorsattn 14 0.70 0.49
## default_vis 13 -0.64 -0.56
## limbic_salventattn 19 -0.62 0.36 0.34
## salventattn_dorsattn 22 0.61 -0.42 0.31
## vis_vis 28 0.58 0.46 0.49
## salventattn_salventattn 23 0.56 0.45 -0.33
## salventattn_sommot 24 0.51 -0.33 0.40
## default_cont 7 0.70 0.40
## cont_sommot 5 -0.65 0.35 0.37 -0.39
## cont_vis 6 -0.39 -0.63 -0.33
## cont_dorsattn 2 -0.58 -0.43
## salventattn_vis 25 0.34 -0.60 -0.50
## limbic_sommot 20 -0.48 -0.56
## cont_limbic 3 0.36 0.51 -0.32 -0.33
## sommot_vis 27 0.44 -0.40 -0.60
## dorsattn_vis 16 0.47 0.36 0.64
## dorsattn_sommot 15 0.53 0.56
## cont_salventattn 4 0.46 0.38 0.55
## sommot_sommot 26 0.42 -0.44 0.52
## cont_cont 1 0.37 0.54 0.49
## limbic_limbic 18 0.53 -0.31 0.57
## h2 u2 com
## default_limbic 0.94 0.064 1.4
## default_dorsattn 0.95 0.049 1.7
## default_default 0.80 0.202 1.2
## limbic_dorsattn 0.77 0.228 1.5
## limbic_vis 0.81 0.192 1.9
## default_sommot 0.78 0.225 2.2
## default_salventattn 0.89 0.113 2.6
## dorsattn_dorsattn 0.87 0.132 2.5
## default_vis 0.89 0.106 2.9
## limbic_salventattn 0.73 0.267 2.9
## salventattn_dorsattn 0.78 0.220 3.3
## vis_vis 0.87 0.128 3.4
## salventattn_salventattn 0.69 0.312 3.1
## salventattn_sommot 0.70 0.301 4.2
## default_cont 0.78 0.217 2.3
## cont_sommot 0.88 0.124 3.2
## cont_vis 0.74 0.262 2.8
## cont_dorsattn 0.76 0.244 3.5
## salventattn_vis 0.87 0.127 3.6
## limbic_sommot 0.77 0.233 3.6
## cont_limbic 0.73 0.269 4.8
## sommot_vis 0.86 0.135 3.7
## dorsattn_vis 0.84 0.159 3.0
## dorsattn_sommot 0.73 0.272 2.9
## cont_salventattn 0.79 0.208 3.7
## sommot_sommot 0.85 0.151 4.6
## cont_cont 0.85 0.148 4.2
## limbic_limbic 0.86 0.136 3.7
##
## TC1 TC2 TC3 TC4 TC5 TC6 TC7 TC8
## SS loadings 8.50 3.62 2.53 1.98 1.88 1.76 1.33 1.19
## Proportion Var 0.30 0.13 0.09 0.07 0.07 0.06 0.05 0.04
## Cumulative Var 0.30 0.43 0.52 0.59 0.66 0.72 0.77 0.81
## Proportion Explained 0.37 0.16 0.11 0.09 0.08 0.08 0.06 0.05
## Cumulative Proportion 0.37 0.53 0.64 0.73 0.81 0.89 0.95 1.00
##
## Mean item complexity = 3
## Test of the hypothesis that 8 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.04
## with the empirical chi square 84.84 with prob < 1
##
## Fit based upon off diagonal values = 0.98
mean(pca_resid$communality) # want this above .7
## [1] 0.8134974
# get scores
comps_resid <- data.frame(pca_resid$scores) %>%
mutate(ssid = unique(avgNetconnBehav$sbjs)) %>%
left_join(behav) %>%
select(-ssid) %>%
rename(attn = TC1,
vis_ldd_wtn = TC2,
limbic_other_wtn = TC8,
sommot_other = TC3,
sommot_wtn_control = TC6,
cont_other = TC5,
vis_ss_wtn = TC4,
contwtn_contvis_dorswtn = TC7)
## Joining, by = "ssid"
## PCA FOR LPF CONNECTIVITY ##
# get connections
lpfConn <- avgNetconn %>%
pivot_wider(names_from = netconn,
values_from = mconnz) %>%
filter(method == "lpf")
# scale connectivity
lpfConn <- scale(lpfConn[,-1:-2])
# run pca
# 7 eigenvalues greater than 1
(pca_lpf <- principal(lpfConn, nfactors = 9,
rotate = "oblimin", use = "pairwise",
scores = TRUE))
## Loading required namespace: GPArotation
## Warning in principal(lpfConn, nfactors = 9, rotate = "oblimin", use =
## "pairwise", : I am sorry, to do these rotations requires the GPArotation package
## to be installed
## Principal Components Analysis
## Call: principal(r = lpfConn, nfactors = 9, rotate = "oblimin", scores = TRUE,
## use = "pairwise")
## Standardized loadings (pattern matrix) based upon correlation matrix
## TC1 TC2 TC3 TC4 TC5 TC6 TC7 TC8 TC9
## cont_cont 0.04 -0.12 0.20 -0.14 0.73 -0.12 -0.20 0.04 0.28
## cont_dorsattn -0.10 0.64 0.41 -0.21 0.13 -0.14 -0.01 -0.06 -0.33
## cont_limbic 0.20 -0.68 -0.30 0.00 0.14 -0.02 0.09 0.13 -0.31
## cont_salventattn -0.14 0.52 0.35 0.05 0.01 0.43 0.04 -0.54 0.04
## cont_sommot 0.02 0.56 0.02 0.40 -0.33 0.24 -0.31 -0.13 -0.18
## cont_vis -0.21 0.27 -0.29 -0.06 -0.58 -0.25 0.08 0.41 0.02
## default_cont 0.16 -0.77 -0.21 0.31 0.16 0.03 -0.11 -0.03 0.20
## default_default 0.79 0.11 0.02 0.16 -0.02 0.13 -0.03 -0.12 0.19
## default_dorsattn -0.87 -0.13 -0.14 0.09 -0.11 -0.18 0.23 -0.14 0.02
## default_limbic 0.78 0.15 0.13 0.05 -0.05 -0.47 0.13 -0.13 -0.14
## default_salventattn -0.66 -0.39 0.08 0.29 0.20 -0.34 -0.14 -0.12 -0.15
## default_sommot -0.61 -0.02 0.59 -0.02 0.17 0.04 0.20 0.29 -0.09
## default_vis -0.54 0.54 -0.42 -0.25 0.19 -0.13 -0.09 0.12 0.01
## dorsattn_dorsattn 0.63 0.12 0.10 -0.12 0.37 0.23 -0.30 0.30 -0.16
## dorsattn_sommot 0.42 0.05 -0.70 0.11 -0.20 0.03 -0.10 -0.08 0.18
## dorsattn_vis 0.50 -0.40 0.51 0.00 -0.25 0.13 -0.05 -0.17 -0.07
## limbic_dorsattn -0.70 -0.19 -0.14 0.01 -0.12 0.41 0.00 -0.11 0.36
## limbic_limbic 0.34 0.31 0.43 0.10 -0.01 -0.56 -0.01 -0.02 0.36
## limbic_salventattn -0.55 -0.35 -0.03 0.16 -0.15 0.23 -0.29 0.10 -0.27
## limbic_sommot -0.49 0.03 0.52 0.03 -0.12 0.18 0.03 0.36 0.28
## limbic_vis -0.41 0.32 -0.52 -0.06 0.41 0.12 0.20 -0.22 -0.06
## salventattn_dorsattn 0.56 0.25 -0.28 -0.26 0.08 0.41 0.07 0.36 -0.09
## salventattn_salventattn 0.41 0.21 0.03 0.37 0.23 0.32 0.36 0.16 0.19
## salventattn_sommot 0.54 0.17 -0.45 0.30 0.02 -0.21 -0.08 0.06 0.05
## salventattn_vis 0.24 -0.28 0.23 -0.66 -0.36 0.05 0.00 0.07 0.19
## sommot_sommot 0.21 -0.20 -0.15 -0.29 0.00 0.02 0.74 -0.16 -0.09
## sommot_vis 0.34 -0.40 0.02 -0.61 -0.04 0.05 -0.24 -0.31 -0.05
## vis_vis 0.43 -0.26 0.38 0.53 -0.03 0.13 0.27 0.08 -0.18
## h2 u2 com
## cont_cont 0.74 0.256 1.9
## cont_dorsattn 0.78 0.219 2.9
## cont_limbic 0.74 0.261 2.3
## cont_salventattn 0.90 0.103 3.8
## cont_sommot 0.80 0.203 4.1
## cont_vis 0.77 0.229 3.8
## default_cont 0.84 0.164 1.9
## default_default 0.73 0.273 1.4
## default_dorsattn 0.91 0.086 1.5
## default_limbic 0.92 0.078 2.0
## default_salventattn 0.89 0.115 3.3
## default_sommot 0.88 0.118 2.9
## default_vis 0.91 0.093 3.9
## dorsattn_dorsattn 0.83 0.166 3.5
## dorsattn_sommot 0.77 0.231 2.2
## dorsattn_vis 0.78 0.220 3.8
## limbic_dorsattn 0.86 0.135 2.6
## limbic_limbic 0.85 0.146 4.2
## limbic_salventattn 0.70 0.301 4.0
## limbic_sommot 0.77 0.231 3.8
## limbic_vis 0.83 0.172 4.7
## salventattn_dorsattn 0.85 0.151 4.5
## salventattn_salventattn 0.70 0.301 6.0
## salventattn_sommot 0.66 0.340 3.3
## salventattn_vis 0.80 0.199 2.8
## sommot_sommot 0.77 0.234 1.9
## sommot_vis 0.81 0.194 3.5
## vis_vis 0.80 0.201 4.5
##
## TC1 TC2 TC3 TC4 TC5 TC6 TC7 TC8 TC9
## SS loadings 6.53 3.66 3.13 2.05 1.81 1.73 1.34 1.28 1.06
## Proportion Var 0.23 0.13 0.11 0.07 0.06 0.06 0.05 0.05 0.04
## Cumulative Var 0.23 0.36 0.48 0.55 0.61 0.68 0.72 0.77 0.81
## Proportion Explained 0.29 0.16 0.14 0.09 0.08 0.08 0.06 0.06 0.05
## Cumulative Proportion 0.29 0.45 0.59 0.68 0.76 0.84 0.90 0.95 1.00
##
## Mean item complexity = 3.3
## Test of the hypothesis that 9 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.05
## with the empirical chi square 100.92 with prob < 1
##
## Fit based upon off diagonal values = 0.97
# plot(pca_lpf$values)
# sum(pca_lpf$values > 1)
print.psych(pca_lpf, digits = 2, cut = .3, sort = TRUE) # run in console for better view
## Principal Components Analysis
## Call: principal(r = lpfConn, nfactors = 9, rotate = "oblimin", scores = TRUE,
## use = "pairwise")
## Standardized loadings (pattern matrix) based upon correlation matrix
## item TC1 TC2 TC3 TC4 TC5 TC6 TC7 TC8
## default_dorsattn 9 -0.87
## default_default 8 0.79
## default_limbic 10 0.78 -0.47
## limbic_dorsattn 17 -0.70 0.41
## default_salventattn 11 -0.66 -0.39 -0.34
## dorsattn_dorsattn 14 0.63 0.37
## default_sommot 12 -0.61 0.59
## salventattn_dorsattn 22 0.56 0.41 0.36
## limbic_salventattn 19 -0.55 -0.35
## salventattn_sommot 24 0.54 -0.45
## salventattn_salventattn 23 0.41 0.37 0.32 0.36
## default_cont 7 -0.77 0.31
## cont_limbic 3 -0.68 -0.30
## cont_dorsattn 2 0.64 0.41
## cont_sommot 5 0.56 0.40 -0.33 -0.31
## default_vis 13 -0.54 0.54 -0.42
## dorsattn_sommot 15 0.42 -0.70
## limbic_sommot 20 -0.49 0.52 0.36
## limbic_vis 21 -0.41 0.32 -0.52 0.41
## dorsattn_vis 16 0.50 -0.40 0.51
## salventattn_vis 25 -0.66 -0.36
## sommot_vis 27 0.34 -0.40 -0.61 -0.31
## vis_vis 28 0.43 0.38 0.53
## cont_cont 1 0.73
## cont_vis 6 -0.58 0.41
## limbic_limbic 18 0.34 0.31 0.43 -0.56
## sommot_sommot 26 0.74
## cont_salventattn 4 0.52 0.35 0.43 -0.54
## TC9 h2 u2 com
## default_dorsattn 0.91 0.086 1.5
## default_default 0.73 0.273 1.4
## default_limbic 0.92 0.078 2.0
## limbic_dorsattn 0.36 0.86 0.135 2.6
## default_salventattn 0.89 0.115 3.3
## dorsattn_dorsattn 0.83 0.166 3.5
## default_sommot 0.88 0.118 2.9
## salventattn_dorsattn 0.85 0.151 4.5
## limbic_salventattn 0.70 0.301 4.0
## salventattn_sommot 0.66 0.340 3.3
## salventattn_salventattn 0.70 0.301 6.0
## default_cont 0.84 0.164 1.9
## cont_limbic -0.31 0.74 0.261 2.3
## cont_dorsattn -0.33 0.78 0.219 2.9
## cont_sommot 0.80 0.203 4.1
## default_vis 0.91 0.093 3.9
## dorsattn_sommot 0.77 0.231 2.2
## limbic_sommot 0.77 0.231 3.8
## limbic_vis 0.83 0.172 4.7
## dorsattn_vis 0.78 0.220 3.8
## salventattn_vis 0.80 0.199 2.8
## sommot_vis 0.81 0.194 3.5
## vis_vis 0.80 0.201 4.5
## cont_cont 0.74 0.256 1.9
## cont_vis 0.77 0.229 3.8
## limbic_limbic 0.36 0.85 0.146 4.2
## sommot_sommot 0.77 0.234 1.9
## cont_salventattn 0.90 0.103 3.8
##
## TC1 TC2 TC3 TC4 TC5 TC6 TC7 TC8 TC9
## SS loadings 6.53 3.66 3.13 2.05 1.81 1.73 1.34 1.28 1.06
## Proportion Var 0.23 0.13 0.11 0.07 0.06 0.06 0.05 0.05 0.04
## Cumulative Var 0.23 0.36 0.48 0.55 0.61 0.68 0.72 0.77 0.81
## Proportion Explained 0.29 0.16 0.14 0.09 0.08 0.08 0.06 0.06 0.05
## Cumulative Proportion 0.29 0.45 0.59 0.68 0.76 0.84 0.90 0.95 1.00
##
## Mean item complexity = 3.3
## Test of the hypothesis that 9 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.05
## with the empirical chi square 100.92 with prob < 1
##
## Fit based upon off diagonal values = 0.97
mean(pca_lpf$communality) # want this above .7
## [1] 0.80639
# get scores
comps_lpf <- data.frame(pca_lpf$scores) %>%
mutate(ssid = unique(avgNetconnBehav$sbjs)) %>%
left_join(behav) %>%
select(-ssid) %>%
rename(vis_wtn_ldd = TC2,
sommot_ldd= TC3,
attn = TC1,
control_other = TC8,
limbic_wtn_other = TC6,
vis_ss_wtn = TC4,
contol_wtn_other = TC5,
limbic_default_dors = TC9,
sommot_wtn_other = TC7)
## Joining, by = "ssid"
How do the network components correlate with behavior for each method?
## CORRELATIONS WITH CAT OLD ##
mdl <- lm(facat_acc_cat_old ~ ., data = comps_rest[,1:9])
summary(mdl)
##
## Call:
## lm(formula = facat_acc_cat_old ~ ., data = comps_rest[, 1:9])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.43371 -0.13150 0.04333 0.14517 0.38795
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.771539 0.029335 26.301 <2e-16 ***
## limbic_wtn_other 0.068149 0.029350 2.322 0.0247 *
## control_other 0.027450 0.029322 0.936 0.3541
## sommot_other -0.014398 0.029469 -0.489 0.6275
## dorsattn_default 0.036544 0.029858 1.224 0.2272
## vis_ssc 0.063113 0.030175 2.092 0.0420 *
## ventattn_other -0.003576 0.029464 -0.121 0.9039
## vis_limdef 0.014473 0.029755 0.486 0.6290
## control_within -0.019123 0.029293 -0.653 0.5171
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2172 on 46 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.2217, Adjusted R-squared: 0.0863
## F-statistic: 1.638 on 8 and 46 DF, p-value: 0.1404
cor(comps_rest, use = "pairwise.complete.obs")
## limbic_wtn_other control_other sommot_other
## limbic_wtn_other 1.000000e+00 8.461764e-16 7.260764e-16
## control_other 8.461764e-16 1.000000e+00 7.216450e-17
## sommot_other 7.260764e-16 7.216450e-17 1.000000e+00
## dorsattn_default 1.065496e-15 -1.023999e-15 4.535908e-18
## vis_ssc 3.427432e-16 7.045540e-17 7.255777e-17
## ventattn_other 1.261122e-16 7.850294e-16 -8.871341e-16
## vis_limdef -3.195962e-16 1.650668e-16 -7.293724e-18
## control_within -4.330944e-16 1.493282e-16 -7.370929e-16
## facat_acc_cat_old 2.988932e-01 1.189947e-01 -5.679167e-02
## facat_acc_cat_new 9.334036e-02 1.421816e-01 -8.818637e-02
## facat_acc_recog_chr -1.681598e-02 7.701288e-02 -1.966396e-01
## dorsattn_default vis_ssc ventattn_other vis_limdef
## limbic_wtn_other 1.065496e-15 3.427432e-16 1.261122e-16 -3.195962e-16
## control_other -1.023999e-15 7.045540e-17 7.850294e-16 1.650668e-16
## sommot_other 4.535908e-18 7.255777e-17 -8.871341e-16 -7.293724e-18
## dorsattn_default 1.000000e+00 1.568353e-16 2.607511e-16 2.257861e-16
## vis_ssc 1.568353e-16 1.000000e+00 6.263879e-17 -2.415494e-16
## ventattn_other 2.607511e-16 6.263879e-17 1.000000e+00 8.800203e-16
## vis_limdef 2.257861e-16 -2.415494e-16 8.800203e-16 1.000000e+00
## control_within 3.669532e-17 -5.164370e-16 -5.168658e-16 4.871025e-17
## facat_acc_cat_old 1.786688e-01 2.707197e-01 -2.333212e-02 5.291635e-02
## facat_acc_cat_new 8.655466e-02 2.382769e-01 7.537041e-02 -1.599194e-02
## facat_acc_recog_chr 1.627649e-01 2.536892e-01 -2.293013e-01 9.820734e-03
## control_within facat_acc_cat_old facat_acc_cat_new
## limbic_wtn_other -4.330944e-16 0.29889318 0.09334036
## control_other 1.493282e-16 0.11899466 0.14218160
## sommot_other -7.370929e-16 -0.05679167 -0.08818637
## dorsattn_default 3.669532e-17 0.17866876 0.08655466
## vis_ssc -5.164370e-16 0.27071971 0.23827689
## ventattn_other -5.168658e-16 -0.02333212 0.07537041
## vis_limdef 4.871025e-17 0.05291635 -0.01599194
## control_within 1.000000e+00 -0.08460287 -0.07970482
## facat_acc_cat_old -8.460287e-02 1.00000000 0.76594276
## facat_acc_cat_new -7.970482e-02 0.76594276 1.00000000
## facat_acc_recog_chr -1.137222e-01 0.27566457 0.08886054
## facat_acc_recog_chr
## limbic_wtn_other -0.016815978
## control_other 0.077012876
## sommot_other -0.196639608
## dorsattn_default 0.162764851
## vis_ssc 0.253689174
## ventattn_other -0.229301318
## vis_limdef 0.009820734
## control_within -0.113722215
## facat_acc_cat_old 0.275664573
## facat_acc_cat_new 0.088860540
## facat_acc_recog_chr 1.000000000
mdl <- lm(facat_acc_cat_old ~ ., data = comps_resid[,1:9])
summary(mdl)
##
## Call:
## lm(formula = facat_acc_cat_old ~ ., data = comps_resid[, 1:9])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.49511 -0.08622 0.00254 0.13128 0.51375
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.771085 0.028515 27.041 < 2e-16 ***
## attn 0.090656 0.028504 3.181 0.00263 **
## vis_ldd_wtn 0.022994 0.029651 0.775 0.44203
## sommot_other -0.010764 0.028765 -0.374 0.70998
## vis_ss_wtn -0.048546 0.028439 -1.707 0.09455 .
## cont_other 0.023492 0.028593 0.822 0.41554
## sommot_wtn_control 0.005699 0.029236 0.195 0.84630
## contwtn_contvis_dorswtn -0.037330 0.030248 -1.234 0.22342
## limbic_other_wtn 0.027841 0.029521 0.943 0.35056
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2107 on 46 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.2678, Adjusted R-squared: 0.1404
## F-statistic: 2.103 on 8 and 46 DF, p-value: 0.05482
cor(comps_resid, use = "pairwise.complete.obs")
## attn vis_ldd_wtn sommot_other vis_ss_wtn
## attn 1.000000e+00 -4.522464e-16 1.127807e-16 -4.853135e-17
## vis_ldd_wtn -4.522464e-16 1.000000e+00 -1.364242e-16 -2.992704e-16
## sommot_other 1.127807e-16 -1.364242e-16 1.000000e+00 -6.170983e-17
## vis_ss_wtn -4.853135e-17 -2.992704e-16 -6.170983e-17 1.000000e+00
## cont_other -6.437450e-17 2.225138e-16 -4.814119e-16 -4.278020e-16
## sommot_wtn_control -2.413611e-16 -2.174910e-16 3.220376e-16 2.304856e-16
## contwtn_contvis_dorswtn 9.245090e-17 -3.938019e-16 2.009105e-16 1.059106e-15
## limbic_other_wtn -2.751045e-16 -1.465881e-16 -5.984806e-16 -8.304920e-16
## facat_acc_cat_old 3.975164e-01 1.284184e-01 -6.007534e-02 -2.125288e-01
## facat_acc_cat_new 2.287969e-01 1.574052e-01 -8.447553e-05 -3.362711e-01
## facat_acc_recog_chr 1.046680e-01 8.784358e-02 -2.764955e-02 -1.473627e-02
## cont_other sommot_wtn_control
## attn -6.437450e-17 -2.413611e-16
## vis_ldd_wtn 2.225138e-16 -2.174910e-16
## sommot_other -4.814119e-16 3.220376e-16
## vis_ss_wtn -4.278020e-16 2.304856e-16
## cont_other 1.000000e+00 -6.016031e-16
## sommot_wtn_control -6.016031e-16 1.000000e+00
## contwtn_contvis_dorswtn -4.232568e-16 -2.296143e-17
## limbic_other_wtn 2.265554e-16 -7.111775e-17
## facat_acc_cat_old 9.636926e-02 4.426398e-02
## facat_acc_cat_new 2.180053e-01 -3.452955e-02
## facat_acc_recog_chr 1.151812e-01 5.185288e-02
## contwtn_contvis_dorswtn limbic_other_wtn
## attn 9.245090e-17 -2.751045e-16
## vis_ldd_wtn -3.938019e-16 -1.465881e-16
## sommot_other 2.009105e-16 -5.984806e-16
## vis_ss_wtn 1.059106e-15 -8.304920e-16
## cont_other -4.232568e-16 2.265554e-16
## sommot_wtn_control -2.296143e-17 -7.111775e-17
## contwtn_contvis_dorswtn 1.000000e+00 -3.448695e-15
## limbic_other_wtn -3.448695e-15 1.000000e+00
## facat_acc_cat_old -1.457096e-01 1.057038e-01
## facat_acc_cat_new -1.549650e-01 7.230003e-02
## facat_acc_recog_chr 2.499673e-02 1.745610e-02
## facat_acc_cat_old facat_acc_cat_new facat_acc_recog_chr
## attn 0.39751641 2.287969e-01 0.10466798
## vis_ldd_wtn 0.12841835 1.574052e-01 0.08784358
## sommot_other -0.06007534 -8.447553e-05 -0.02764955
## vis_ss_wtn -0.21252879 -3.362711e-01 -0.01473627
## cont_other 0.09636926 2.180053e-01 0.11518124
## sommot_wtn_control 0.04426398 -3.452955e-02 0.05185288
## contwtn_contvis_dorswtn -0.14570959 -1.549650e-01 0.02499673
## limbic_other_wtn 0.10570381 7.230003e-02 0.01745610
## facat_acc_cat_old 1.00000000 7.659428e-01 0.27566457
## facat_acc_cat_new 0.76594276 1.000000e+00 0.08886054
## facat_acc_recog_chr 0.27566457 8.886054e-02 1.00000000
mdl <- lm(facat_acc_cat_old ~ ., data = comps_lpf[,1:10])
summary(mdl)
##
## Call:
## lm(formula = facat_acc_cat_old ~ ., data = comps_lpf[, 1:10])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.43671 -0.16119 0.04812 0.12679 0.32208
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.769362 0.027310 28.171 < 2e-16 ***
## attn 0.069255 0.027393 2.528 0.01504 *
## vis_wtn_ldd -0.027560 0.027270 -1.011 0.31758
## sommot_ldd 0.033782 0.027356 1.235 0.22329
## vis_ss_wtn -0.001671 0.028024 -0.060 0.95272
## contol_wtn_other -0.017117 0.029343 -0.583 0.56258
## limbic_wtn_other -0.067329 0.028129 -2.394 0.02091 *
## sommot_wtn_other -0.004275 0.027778 -0.154 0.87837
## control_other -0.026416 0.027272 -0.969 0.33793
## limbic_default_dors 0.078816 0.027563 2.859 0.00641 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2018 on 45 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.3427, Adjusted R-squared: 0.2113
## F-statistic: 2.607 on 9 and 45 DF, p-value: 0.01628
cor(comps_lpf, use = "pairwise.complete.obs")
## attn vis_wtn_ldd sommot_ldd vis_ss_wtn
## attn 1.000000e+00 9.055961e-16 -3.566863e-16 1.107907e-16
## vis_wtn_ldd 9.055961e-16 1.000000e+00 -9.669349e-16 1.268753e-16
## sommot_ldd -3.566863e-16 -9.669349e-16 1.000000e+00 -1.836441e-17
## vis_ss_wtn 1.107907e-16 1.268753e-16 -1.836441e-17 1.000000e+00
## contol_wtn_other 2.050113e-16 4.212145e-16 2.628569e-16 -1.314077e-15
## limbic_wtn_other 7.452187e-17 -1.016824e-16 -2.694851e-16 1.376937e-17
## sommot_wtn_other -1.684711e-16 1.484943e-16 -2.127658e-16 -7.914341e-16
## control_other -3.268638e-16 1.298490e-16 4.448942e-16 -1.991418e-16
## limbic_default_dors 3.133938e-16 -8.402961e-16 4.699918e-17 6.028204e-16
## facat_acc_cat_old 2.948292e-01 -1.303401e-01 1.631787e-01 -3.854787e-02
## facat_acc_cat_new 2.452039e-01 -2.141799e-01 7.206299e-02 6.029625e-04
## facat_acc_recog_chr 2.004885e-01 -6.075535e-02 1.296779e-01 4.067566e-02
## contol_wtn_other limbic_wtn_other sommot_wtn_other
## attn 2.050113e-16 7.452187e-17 -1.684711e-16
## vis_wtn_ldd 4.212145e-16 -1.016824e-16 1.484943e-16
## sommot_ldd 2.628569e-16 -2.694851e-16 -2.127658e-16
## vis_ss_wtn -1.314077e-15 1.376937e-17 -7.914341e-16
## contol_wtn_other 1.000000e+00 1.478190e-15 1.124002e-16
## limbic_wtn_other 1.478190e-15 1.000000e+00 1.799933e-16
## sommot_wtn_other 1.124002e-16 1.799933e-16 1.000000e+00
## control_other -1.698841e-16 -3.852391e-16 -2.108543e-15
## limbic_default_dors -5.723917e-16 2.193883e-16 -3.064054e-17
## facat_acc_cat_old -2.798415e-02 -2.735663e-01 6.306349e-03
## facat_acc_cat_new -9.070955e-02 -3.199151e-01 2.399539e-03
## facat_acc_recog_chr -7.141898e-02 -2.180991e-02 -1.175632e-02
## control_other limbic_default_dors facat_acc_cat_old
## attn -3.268638e-16 3.133938e-16 0.294829174
## vis_wtn_ldd 1.298490e-16 -8.402961e-16 -0.130340082
## sommot_ldd 4.448942e-16 4.699918e-17 0.163178669
## vis_ss_wtn -1.991418e-16 6.028204e-16 -0.038547867
## contol_wtn_other -1.698841e-16 -5.723917e-16 -0.027984146
## limbic_wtn_other -3.852391e-16 2.193883e-16 -0.273566325
## sommot_wtn_other -2.108543e-15 -3.064054e-17 0.006306349
## control_other 1.000000e+00 -3.314155e-16 -0.125457766
## limbic_default_dors -3.314155e-16 1.000000e+00 0.333320054
## facat_acc_cat_old -1.254578e-01 3.333201e-01 1.000000000
## facat_acc_cat_new -6.951496e-02 2.843521e-01 0.765942761
## facat_acc_recog_chr -5.915024e-02 2.299767e-01 0.275664573
## facat_acc_cat_new facat_acc_recog_chr
## attn 0.2452038535 0.20048855
## vis_wtn_ldd -0.2141798820 -0.06075535
## sommot_ldd 0.0720629944 0.12967788
## vis_ss_wtn 0.0006029625 0.04067566
## contol_wtn_other -0.0907095501 -0.07141898
## limbic_wtn_other -0.3199150937 -0.02180991
## sommot_wtn_other 0.0023995389 -0.01175632
## control_other -0.0695149639 -0.05915024
## limbic_default_dors 0.2843520862 0.22997672
## facat_acc_cat_old 0.7659427607 0.27566457
## facat_acc_cat_new 1.0000000000 0.08886054
## facat_acc_recog_chr 0.0888605397 1.00000000
comps_lpf %>%
ggplot(aes(x = limbic_wtn_other,
y = facat_acc_cat_old)) +
geom_point() +
geom_smooth(method = "lm")
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## CORRELATIONS WITH CAT NEW ##
mdl <- lm(facat_acc_cat_new ~ ., data = comps_rest[,c(1:8,10)])
summary(mdl)
##
## Call:
## lm(formula = facat_acc_cat_new ~ ., data = comps_rest[, c(1:8,
## 10)])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.54116 -0.13148 0.03785 0.13283 0.41762
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.7069983 0.0297026 23.803 <2e-16 ***
## limbic_wtn_other 0.0208264 0.0297175 0.701 0.4870
## control_other 0.0310112 0.0296889 1.045 0.3017
## sommot_other -0.0203482 0.0298380 -0.682 0.4987
## dorsattn_default 0.0153231 0.0302315 0.507 0.6147
## vis_ssc 0.0531695 0.0305532 1.740 0.0885 .
## ventattn_other 0.0176028 0.0298330 0.590 0.5580
## vis_limdef -0.0007819 0.0301271 -0.026 0.9794
## control_within -0.0171056 0.0296601 -0.577 0.5669
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.22 on 46 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.1144, Adjusted R-squared: -0.03958
## F-statistic: 0.743 on 8 and 46 DF, p-value: 0.6534
mdl <- lm(facat_acc_cat_new ~ ., data = comps_resid[,c(1:8,10)])
summary(mdl)
##
## Call:
## lm(formula = facat_acc_cat_new ~ ., data = comps_resid[, c(1:8,
## 10)])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.38838 -0.12143 0.02183 0.13161 0.33458
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.705921 0.026991 26.154 < 2e-16 ***
## attn 0.050400 0.026980 1.868 0.06813 .
## vis_ldd_wtn 0.026594 0.028066 0.948 0.34831
## sommot_other 0.003143 0.027228 0.115 0.90859
## vis_ss_wtn -0.072693 0.026918 -2.701 0.00966 **
## cont_other 0.048648 0.027065 1.797 0.07882 .
## sommot_wtn_control -0.012076 0.027673 -0.436 0.66460
## contwtn_contvis_dorswtn -0.038821 0.028631 -1.356 0.18175
## limbic_other_wtn 0.020654 0.027943 0.739 0.46358
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.1994 on 46 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.2719, Adjusted R-squared: 0.1453
## F-statistic: 2.147 on 8 and 46 DF, p-value: 0.04999
mdl <- lm(facat_acc_cat_new ~ ., data = comps_lpf[,c(1:9,11)])
summary(mdl)
##
## Call:
## lm(formula = facat_acc_cat_new ~ ., data = comps_lpf[, c(1:9,
## 11)])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.3898 -0.1212 0.0272 0.1090 0.2960
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.703593 0.026255 26.799 < 2e-16 ***
## attn 0.056156 0.026334 2.132 0.03846 *
## vis_wtn_ldd -0.043520 0.026216 -1.660 0.10385
## sommot_ldd 0.011794 0.026299 0.448 0.65599
## vis_ss_wtn 0.008695 0.026941 0.323 0.74839
## contol_wtn_other -0.032288 0.028209 -1.145 0.25843
## limbic_wtn_other -0.075802 0.027041 -2.803 0.00744 **
## sommot_wtn_other -0.006624 0.026704 -0.248 0.80523
## control_other -0.012583 0.026218 -0.480 0.63360
## limbic_default_dors 0.065811 0.026497 2.484 0.01679 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.194 on 45 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.3259, Adjusted R-squared: 0.1911
## F-statistic: 2.417 on 9 and 45 DF, p-value: 0.02473
## CORRELATIONS WITH RECOG CHR ##
mdl <- lm(facat_acc_recog_chr ~ ., data = comps_rest[,c(1:8,11)])
summary(mdl)
##
## Call:
## lm(formula = facat_acc_recog_chr ~ ., data = comps_rest[, c(1:8,
## 11)])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.55137 -0.11782 0.01408 0.16348 0.31996
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.606807 0.029291 20.717 <2e-16 ***
## limbic_wtn_other -0.003290 0.029306 -0.112 0.9111
## control_other 0.017338 0.029277 0.592 0.5566
## sommot_other -0.044057 0.029424 -1.497 0.1411
## dorsattn_default 0.034076 0.029812 1.143 0.2590
## vis_ssc 0.056355 0.030130 1.870 0.0678 .
## ventattn_other -0.049767 0.029419 -1.692 0.0975 .
## vis_limdef 0.003363 0.029709 0.113 0.9104
## control_within -0.025208 0.029249 -0.862 0.3932
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2169 on 46 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.1971, Adjusted R-squared: 0.05743
## F-statistic: 1.411 on 8 and 46 DF, p-value: 0.2174
mdl <- lm(facat_acc_recog_chr ~ ., data = comps_resid[,c(1:8,11)])
summary(mdl)
##
## Call:
## lm(formula = facat_acc_recog_chr ~ ., data = comps_resid[, c(1:8,
## 11)])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.52639 -0.15547 0.04647 0.16901 0.33266
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.608633 0.032160 18.925 <2e-16 ***
## attn 0.022693 0.032147 0.706 0.484
## vis_ldd_wtn 0.020406 0.033441 0.610 0.545
## sommot_other -0.006905 0.032442 -0.213 0.832
## vis_ss_wtn -0.003033 0.032074 -0.095 0.925
## cont_other 0.024784 0.032248 0.769 0.446
## sommot_wtn_control 0.012524 0.032973 0.380 0.706
## contwtn_contvis_dorswtn 0.007203 0.034114 0.211 0.834
## limbic_other_wtn 0.002256 0.033295 0.068 0.946
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2376 on 46 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.03625, Adjusted R-squared: -0.1314
## F-statistic: 0.2163 on 8 and 46 DF, p-value: 0.9864
mdl <- lm(facat_acc_recog_chr ~ ., data = comps_lpf[,c(1:9,12)])
summary(mdl)
##
## Call:
## lm(formula = facat_acc_recog_chr ~ ., data = comps_lpf[, c(1:9,
## 12)])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.47012 -0.10112 0.01336 0.17824 0.31289
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.604889 0.030903 19.573 <2e-16 ***
## attn 0.046282 0.030997 1.493 0.1424
## vis_wtn_ldd -0.012270 0.030858 -0.398 0.6928
## sommot_ldd 0.026725 0.030956 0.863 0.3925
## vis_ss_wtn 0.013333 0.031711 0.420 0.6762
## contol_wtn_other -0.022287 0.033204 -0.671 0.5055
## limbic_wtn_other -0.009522 0.031830 -0.299 0.7662
## sommot_wtn_other -0.006328 0.031433 -0.201 0.8413
## control_other -0.011885 0.030861 -0.385 0.7020
## limbic_default_dors 0.053394 0.031189 1.712 0.0938 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2284 on 45 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.1292, Adjusted R-squared: -0.04497
## F-statistic: 0.7418 on 9 and 45 DF, p-value: 0.6689